This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix comparison of objfile and separate debug sections


The FIXME I'm deleting in this patch has been there since the dawn of
the CVS repository, and does not seem to be true then - but definitely
isn't true now.

Due to recent changes, we now use this function when loading a
separate debug objfile.  And we call filter_debuginfo_sections which
compares the sections in the two objfiles, trying to identify which
ones come from a separate debug objfile - but only by offset, not by
name.  (I expect this would break for some overlay cases too.)

In my ARM EABI test environment, .text isn't the lowest section;
.note.gnu.build-id comes at zero and then .text right afterwards.
Probably this indicates a busted linker script somewhere, which I'll
look into next... anyway, the net result is that GDB wackily concludes
that the separate debug file for sepdebug.exp was loaded with an 0x30
offset, which is the size of .note.gnu.build-id.  And then we decide
that .text in the main file is a duplicate of .note.gnu.build-id in the
separate debug file, and discard it.  This eventually results in a
symbol lookup not finding any section in the pspace's map that
covers .text.  So a breakpoint at exit prints out "0xa08 in ???" when
we're clearly in exit.

The fix is straightforward: we have a working find_lowest_section, so
use it instead of hard-coding ".text".

Tested on arm-none-eabi and x86_64-linux; committed on trunk.

-- 
Daniel Jacobowitz
CodeSourcery

2010-02-16  Daniel Jacobowitz  <dan@codesourcery.com>

	gdb/
	* symfile.c (addr_info_make_relative): Always use
	find_lowest_section.

diff -urp gdb-merged-orig/gdb/symfile.c gdb-merged/gdb/symfile.c
--- gdb-merged-orig/gdb/symfile.c	2010-02-11 14:21:13.000000000 -0800
+++ gdb-merged/gdb/symfile.c	2010-02-15 08:50:12.000000000 -0800
@@ -573,11 +573,9 @@ addr_info_make_relative (struct section_
   int i;
 
   /* Find lowest loadable section to be used as starting point for
-     continguous sections. FIXME!! won't work without call to find
-     .text first, but this assumes text is lowest section. */
-  lower_sect = bfd_get_section_by_name (abfd, ".text");
-  if (lower_sect == NULL)
-    bfd_map_over_sections (abfd, find_lowest_section, &lower_sect);
+     continguous sections.  */
+  lower_sect = NULL;
+  bfd_map_over_sections (abfd, find_lowest_section, &lower_sect);
   if (lower_sect == NULL)
     {
       warning (_("no loadable sections found in added symbol-file %s"),


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]