From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFC] problem in solib-svr4/enable_break
Date: Thu, 14 Jan 2010 22:07:00 -0000 [thread overview]
Message-ID: <4B4F95C3.5080209@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
The attached patch isn't for submission, but just to help
illustrate the problem. It fixes a symptom but seems kludgy
to me (and not well understood).
Here's the problem. I have a kernel image which is statically
linked and PIE. When it gets to enable_break, it succeeds in
finding "debug_base", but "debug_base" is in the text section
of the main executable (ie. not in the dynamic loader, which is
not actually present).
Therefore we compute info->interp_text_sect_low and
info->interp_text_sect_high as the start and end of the text
section of the main executable. And therefore whenever we
call in_solib_dynsym_resolve_code(), it returns TRUE, and
therefore source level stepping won't work.
This simple patch just checks to see whether "tmp_bfd" (which
is supposed to be the dynamic loader) matches exec_bfd, and
if so, lets interp_text_sect_low and interp_text_sect_high
remain zero.
Anybody got a better suggestion?
[-- Attachment #2: svr4.txt --]
[-- Type: text/plain, Size: 706 bytes --]
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.110
diff -u -p -r1.110 solib-svr4.c
--- solib-svr4.c 8 Jan 2010 22:52:03 -0000 1.110
+++ solib-svr4.c 14 Jan 2010 21:57:37 -0000
@@ -1312,7 +1312,10 @@ enable_break (struct svr4_info *info, in
os->objfile->sect_index_text);
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
- if (interp_sect)
+
+ /* Skip if tmp_bfd points to main executable. */
+ if (interp_sect
+ && strcmp (tmp_bfd->filename, exec_bfd->filename) != 0)
{
info->interp_text_sect_low =
bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
next reply other threads:[~2010-01-14 22:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 22:07 Michael Snyder [this message]
2010-01-15 0:44 ` [rfc] Fix "step" for ld.so debugging [Re: [RFC] problem in solib-svr4/enable_break] Jan Kratochvil
2010-01-15 17:46 ` Michael Snyder
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=4B4F95C3.5080209@vmware.com \
--to=msnyder@vmware.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