From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: RFC: fix bug when debugging prelink'd library
Date: Mon, 12 Jul 2010 19:34:00 -0000 [thread overview]
Message-ID: <m38w5gwl37.fsf@fleche.redhat.com> (raw)
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. */
next reply other threads:[~2010-07-12 19:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-12 19:34 Tom Tromey [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m38w5gwl37.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox