From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC/ia64-linux] pb with shared libraries when attaching to process
Date: Fri, 25 Apr 2008 19:00:00 -0000 [thread overview]
Message-ID: <20080425175952.GA841@adacore.com> (raw)
In-Reply-To: <20080425032341.GA15147@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 2161 bytes --]
> > Looking deeper into this, the problem is that GDB determins that
> > this symbol is in the .data section. The code that recognizes
> > function descriptors for ia64 checks first that the associated
> > section name is ".opd", or else checks the name of the symbol
> > with is_vtable_name() (see ia64-tdep.c:ia64_convert_from_func_ptr_addr).
> >
> > I double checked /lib/ld-linux-ia64.so.2, and unless I'm mistaken,
> > the debugger is correct. Our address is inside the .data section
> > of the loader. There is no .opd section in sight.
Eric Botcazou suggested that an address pointing to the .data section
should never be some code because the .data section is not executable;
So we could simply check the flags of our section, and if it doesn't
have the CODE flag set, then assume it's a function descriptor.
I have succesfully tested the following patch with gdb-6.8 (HEAD is
having some issues causing the inferior to fail to start with a SIGILL
at the moment - I'll look at that next).
2008-04-25 Joel Brobecker <brobecker@adacore.com>
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Treat addresses
pointing inside a non-executable section as function descriptors.
Results before and after the patch:
+------------+------------+----------------------------------------------------+
| FAIL | PASS | attach.exp: after attach2, reach tbreak postloop |
| FAIL | PASS | attach.exp: after attach2, exit |
| UNRESOLVED | PASS | attach.exp: before attach3, flush exec |
| UNRESOLVED | PASS | attach.exp: attach when process' a.out not in cwd |
| FAIL | PASS | attach.exp: c |
+------------+------------+----------------------------------------------------+
The attached patch is something that I would consider for gdb-6.8.
For gdb-head, I might even go one step farther and remove the check
for the .opd section name just above, since the new check should
handle the .opd section as well.
I'm also wondering about the vtable-related symbols, but that's
harder for me to verify...
What do you think?
--
Joel
[-- Attachment #2: fundesc.diff --]
[-- Type: text/plain, Size: 682 bytes --]
Index: ia64-tdep.c
===================================================================
--- ia64-tdep.c (revision 130268)
+++ ia64-tdep.c (working copy)
@@ -3328,6 +3328,12 @@ ia64_convert_from_func_ptr_addr (struct
if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
return read_memory_unsigned_integer (addr, 8);
+ /* If ADDR points to a section that is not executable, then it cannot
+ be pointing to a function. So it must be pointing to a function
+ descriptor. */
+ if (s && (s->the_bfd_section->flags & SEC_CODE) == 0)
+ return read_memory_unsigned_integer (addr, 8);
+
/* There are also descriptors embedded in vtables. */
if (s)
{
next prev parent reply other threads:[~2008-04-25 18:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-25 2:06 Joel Brobecker
2008-04-25 2:36 ` Daniel Jacobowitz
2008-04-25 14:26 ` Joel Brobecker
2008-04-25 16:15 ` Daniel Jacobowitz
2008-04-25 19:00 ` Joel Brobecker [this message]
2008-05-02 15:01 ` Daniel Jacobowitz
2008-05-07 10:12 ` Joel Brobecker
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=20080425175952.GA841@adacore.com \
--to=brobecker@adacore.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