From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [patch] solib-svr4.c: Document why we need section info of the dynamic linker.
Date: Tue, 26 Jan 2010 20:41:00 -0000 [thread overview]
Message-ID: <20100126204119.88F5D84414@ruffy.mtv.corp.google.com> (raw)
Hi.
This patch is based on info from Daniel on irc.
It documents why we don't call create_solib_event_breakpoint (sym_addr)
unless we have section info on the dynamic linker.
I'll check it in tomorrow if there are no objections.
For the ARM case, one *could* try to pass a non-addr_bits_remove'd
address to create_solib_event_breakpoint and get that working.
Another hacky thought is to fake the necessary section/symbol info
when gdb can't find the dynamic linker (which can happen for cross-debugging
via gdbserver).
That is left for a later pass. This patch just documents what's there today.
2010-01-26 Doug Evans <dje@google.com>
* solib-svr4.c (enable_break): Document why we need section info
of the dynamic linker.
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.115
diff -u -p -r1.115 solib-svr4.c
--- solib-svr4.c 14 Jan 2010 21:16:52 -0000 1.115
+++ solib-svr4.c 26 Jan 2010 20:36:06 -0000
@@ -1307,6 +1308,26 @@ enable_break (struct svr4_info *info, in
sym_addr,
¤t_target));
+ /* On at least some versions of Solaris there's a dynamic relocation
+ on _r_debug.rtld_db_dlactivity (or however it's spelled on Solaris)
+ and SYM_ADDR may not be relocated yet, e.g., if we get control
+ before the dynamic linker has self-relocated. Check if SYM_ADDR is
+ in a known section, if it is assume we can trust its value.
+ This is just a heuristic though, it could go away or be replaced if
+ it's getting in the way.
+
+ On ARM we need to know whether the ISA of rtld_db_dlactivity (or
+ however it's spelled in your particular system) is ARM or Thumb.
+ That knowledge is encoded in the address, if it's Thumb the low bit
+ is 1. However, we've stripped that info above and it's not clear
+ what all the consequences are of passing a non-addr_bits_remove'd
+ address to create_solib_event_breakpoint. The call to
+ find_pc_section verifies we know about the address and have some
+ hope of computing the right kind of breakpoint to use (via
+ symbol info). It does mean that GDB needs to be pointed at a
+ non-stripped version of the dynamic linker in order to obtain
+ information it already knows about. Sigh. */
+
os = find_pc_section (sym_addr);
if (os != NULL)
{
next reply other threads:[~2010-01-26 20:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-26 20:41 Doug Evans [this message]
2010-01-26 20:46 ` Daniel Jacobowitz
2010-01-26 20:56 ` Doug Evans
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=20100126204119.88F5D84414@ruffy.mtv.corp.google.com \
--to=dje@google.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