This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug shlibs/15507] New: .dynamic section is not at the expected address
- From: "bccheng at android dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 21 May 2013 00:16:01 +0000
- Subject: [Bug shlibs/15507] New: .dynamic section is not at the expected address
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15507
Bug #: 15507
Summary: .dynamic section is not at the expected address
Product: gdb
Version: 7.6
Status: NEW
Severity: normal
Priority: P2
Component: shlibs
AssignedTo: unassigned@sourceware.org
ReportedBy: bccheng@android.com
Classification: Unclassified
Currently Android is using gdbserver from 7.1 and gdb from 7.3. I tried to
upgrade Android gdb to 7.6 but I found it complained with the following
message:
(gdb) b main
Breakpoint 1 at 0xb6fc2448: file <test_program>/main.c, line 10.
(gdb) c
Continuing.
warning: .dynamic section for "<test_program>" is not at the expected address
(wrong library or version mismatch?)
Error in re-setting breakpoint 1: Cannot access memory at address 0xffffe570
Error in re-setting breakpoint 1: Cannot access memory at address 0xffffe570
Error in re-setting breakpoint 1: Cannot access memory at address 0xffffe570
Error in re-setting breakpoint 1: Cannot access memory at address 0xffffe570
After digging into the problem a bit more, I think the problem is in
solib-svr4.c/svr4_current_sos() where if gdbserver responds to the
svr4_current_sos_via_xfer_libraries call, it is not skipping the first entry in
the link map:
if (svr4_current_sos_via_xfer_libraries (&library_list))
{
if (library_list.main_lm)
{
info = get_svr4_info ();
info->main_lm_addr = library_list.main_lm;
}
return library_list.head ? library_list.head : svr4_default_sos ();
}
And here is the xml string:
<library-list-svr4 version="1.0"><library name="<test_program>" lm="0xb6fed108"
l_addr="0x0" l_ld="0x0"/><library name="/system/bin/linker" lm="0xb6ffe75c"
l_addr="0xb6fee000" l_ld="0xb6ffded8"/></library-list-svr4>
In the same function it has the following code to deal with older gdbserver
where it can ignore the first entry in the link map:
/* Assume that everything is a library if the dynamic loader was loaded
late by a static executable. */
if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
ignore_first = 0;
else
ignore_first = 1;
back_to = make_cleanup (svr4_free_library_list, &head);
/* Walk the inferior's link map list, and build our list of
`struct so_list' nodes. */
lm = solib_svr4_r_map (info);
if (lm)
svr4_read_so_list (lm, &link_ptr, ignore_first);
I tried a simple hack and gdb 7.6 starts to work for Android with gdbserver
7.6:
- return library_list.head ? library_list.head : svr4_default_sos ();
+ if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
+ return library_list.head ? library_list.head : svr4_default_sos ();
+ else
+ return library_list.head ? library_list.head : svr4_default_sos ();
Not sure if there is a better patch fix the problem.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.