Discussion:
[Bug gdb/23105] New: Core file error 'Cannot access memory at address' on FreeBSD
rajendra.sy at gmail dot com
2018-04-22 03:15:44 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23105

Bug ID: 23105
Summary: Core file error 'Cannot access memory at address' on
FreeBSD
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: rajendra.sy at gmail dot com
Target Milestone: ---

Test case: gdb.base/gcore-relro-pie.exp
Examining memory using "x/i $pc" fails with error message cannot access memory.
The test fails only with "pie" option.

I tried to compile above test case with/without pie option as below:
Using gcc-6.4.0 on FreeBSD-10.3:

1. With "-fpie -pie" option
$ gcc -fpie -pie -Wl,-z,relro -lm -g -o gcore-relro-pie ./gcore-relro-pie.c
$ strip -g -o gcore-relro-pie.stripped gcore-relro-pie
$ ./gcore-relro-pie.stripped
Segmentation fault (core dumped)
$ gdb
(gdb) file gcore-relro-pie.stripped
(gdb) core gcore-relro-pie.str.core
(gdb) x/i $pc
=> 0x1021944: Cannot access memory at address 0x1021944

2. Without "-fpie -pie" option
$ gcc -Wl,-z,relro -lm -g -o gcore-relro ./gcore-relro-pie.c
$ strip -g -o gcore-relro.stripped gcore-relro
$ ./gcore-relro.stripped
Segmentation fault (core dumped)
$ gdb
(gdb) file gcore-relro.stripped
(gdb) core gcore-relro.strippe.core
(gdb) x/i $pc
=> 0x40076f <break_here+9>: movl $0x0,(%rax)
--
You are receiving this mail because:
You are on the CC list for the bug.
cvs-commit at gcc dot gnu.org
2018-09-06 22:12:48 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23105

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by John Baldwin <***@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=739ab2e92e1840c9285f3cfce1f1236c0fa68730

commit 739ab2e92e1840c9285f3cfce1f1236c0fa68730
Author: Simon Ser <***@emersion.fr>
Date: Thu Sep 6 15:03:19 2018 -0700

Generate NT_PROCSTAT_{AUXV,VMMAP,PS_STRINGS} in FreeBSD coredumps

gcore generates NT_AUXV and NT_FILE notes for Linux targets. On
FreeBSD auxv is stored in a NT_PROCSTAT_AUXV section, virtual memory
mappings are stored in a NT_PROCSTAT_VMMAP, and both are prefixed with
the struct size. In addition, store a NT_PROCSTAT_PS_STRINGS note
saving the initial location of the argv[] and environment[] arrays.

gdb/ChangeLog:

PR gdb/23105
* fbsd-nat.c (fbsd_nat_target::xfer_partial): Add support for
TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
* fbsd-tdep.c (fbsd_make_note_desc): New.
(fbsd_make_corefile_notes): Write NT_PROCSTAT_AUXV,
NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes.
* target.h (enum target_object) Add FreeBSD-specific
TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
--
You are receiving this mail because:
You are on the CC list for the bug.
jhb at FreeBSD dot org
2018-09-06 23:08:08 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23105

jhb at FreeBSD dot org changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jhb at FreeBSD dot org
Resolution|--- |FIXED

--- Comment #2 from jhb at FreeBSD dot org ---
The above commit fixed the test case in my testing locally. Thanks for the
diagnosis and earlier patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-09-07 14:20:17 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23105

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
Target Milestone|--- |8.3
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...