Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: fix bug when debugging prelink'd library
@ 2010-07-12 19:34 Tom Tromey
  2010-07-12 19:47 ` Jan Kratochvil
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2010-07-12 19:34 UTC (permalink / raw)
  To: gdb-patches

I plan to check this in, but I wanted to ask for comments first, because
I think at least Jan disagrees with this direction.  Once the discussion
is over I plan to commit this, or its replacement, to both the trunk and
the 7.2 branch.

When debugging a program linked with -lpthread I found that I couldn't
print a variable in one of the pthread functions.  However, I have full
debuginfo installed, and the debuginfo is correct for this particular
variable.

Jan pointed out a Fedora patch that showed the problem --
dwarf2_per_cu_objfile was returning the master objfile, not the
debuginfo objfile.  But, at least in the prelink case, the master
objfile does not have the same section offsets as the debuginfo objfile.

This fixes the problem by changing dwarf2_per_cu_objfile to return the
debuginfo objfile.  This appears to be correct for all callers except
one, which I also updated.

Built and regtested on x86-64 (compile farm).
I also tried it locally on my prelink test case.

Tom

2010-07-12  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (dwarf2_per_cu_objfile): Return the objfile, not
	the master objfile.
	* dwarf2loc.c (dwarf_expr_tls_address): Use the master objfile.

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.94
diff -u -r1.94 dwarf2loc.c
--- dwarf2loc.c	7 Jul 2010 17:26:38 -0000	1.94
+++ dwarf2loc.c	12 Jul 2010 19:25:11 -0000
@@ -234,6 +234,10 @@
   struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
   struct objfile *objfile = dwarf2_per_cu_objfile (debaton->per_cu);
 
+  /* Use the master objfile.  */
+  if (objfile->separate_debug_objfile_backlink)
+    objfile = objfile->separate_debug_objfile_backlink;
+
   return target_translate_tls_address (objfile, offset);
 }
 
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.411
diff -u -r1.411 dwarf2read.c
--- dwarf2read.c	12 Jul 2010 17:07:11 -0000	1.411
+++ dwarf2read.c	12 Jul 2010 19:25:12 -0000
@@ -12054,14 +12054,7 @@
 struct objfile *
 dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu)
 {
-  struct objfile *objfile = per_cu->psymtab->objfile;
-
-  /* Return 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;
-
-  return objfile;
+  return per_cu->psymtab->objfile;
 }
 
 /* Return the address size given in the compilation unit header for CU.  */


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-13 15:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-12 19:34 RFC: fix bug when debugging prelink'd library Tom Tromey
2010-07-12 19:47 ` Jan Kratochvil
2010-07-12 20:24   ` Tom Tromey
2010-07-12 21:06     ` Tom Tromey
2010-07-12 21:22       ` Jan Kratochvil
2010-07-13 15:08         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox