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 TLS display for .gnu_debuglink


If you have a stripped libc.so, and point GDB to a separate copy using
set debug-file-directory and objfile --only-keep-debug that has
symbols, GDB will fail to print errno.  It will say:

Cannot find shared library `/usr/lib/debug/lib/tls/libc-2.3.3.so.debug' link_map in dynamic linker's module list

The fix is to always record the master objfile;
/lib/tls/libc-2.3.3.so.debug is in the list.  I picked this solution
rather than changing the module list search, since it also fixes
"info addr errno" to report the correct library.

Tested on x86_64-linux and committed.

-- 
Daniel Jacobowitz
CodeSourcery

2007-06-05  Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2read.c (dwarf2_symbol_mark_computed): Fix formatting.
	Use the original objfile if necessary.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.221
diff -u -p -r1.221 dwarf2read.c
--- dwarf2read.c	4 Jun 2007 12:34:11 -0000	1.221
+++ dwarf2read.c	5 Jun 2007 15:03:32 -0000
@@ -1046,9 +1046,9 @@ static void dwarf_decode_macros (struct 
 
 static int attr_form_is_block (struct attribute *);
 
-static void
-dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
-			     struct dwarf2_cu *cu);
+static void dwarf2_symbol_mark_computed (struct attribute *attr,
+					 struct symbol *sym,
+					 struct dwarf2_cu *cu);
 
 static gdb_byte *skip_one_die (gdb_byte *info_ptr, struct abbrev_info *abbrev,
                                struct dwarf2_cu *cu);
@@ -9698,6 +9698,13 @@ static void
 dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
 			     struct dwarf2_cu *cu)
 {
+  struct objfile *objfile = cu->objfile;
+
+  /* Save the master objfile, so that we can report and look up the
+     correct file containing this variable.  */
+  if (objfile->separate_debug_objfile_backlink)
+    objfile = objfile->separate_debug_objfile_backlink;
+
   if ((attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
       /* ".debug_loc" may not exist at all, or the offset may be outside
 	 the section.  If so, fall through to the complaint in the
@@ -9708,7 +9715,7 @@ dwarf2_symbol_mark_computed (struct attr
 
       baton = obstack_alloc (&cu->objfile->objfile_obstack,
 			     sizeof (struct dwarf2_loclist_baton));
-      baton->objfile = cu->objfile;
+      baton->objfile = objfile;
 
       /* We don't know how long the location list is, but make sure we
 	 don't run off the edge of the section.  */
@@ -9728,7 +9735,7 @@ dwarf2_symbol_mark_computed (struct attr
 
       baton = obstack_alloc (&cu->objfile->objfile_obstack,
 			     sizeof (struct dwarf2_locexpr_baton));
-      baton->objfile = cu->objfile;
+      baton->objfile = objfile;
 
       if (attr_form_is_block (attr))
 	{


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