From: Daniel Jacobowitz <drow@false.org>
To: Ulrich Weigand <uweigand@de.ibm.com>,
gdb-patches@sourceware.org, bauerman@br.ibm.com,
amodra@bigpond.net.au
Subject: Re: Shared library call problems on PowerPC with current binutils/gdb
Date: Fri, 02 May 2008 23:01:00 -0000 [thread overview]
Message-ID: <20080502215132.GA12244@caradoc.them.org> (raw)
In-Reply-To: <20080429003951.GA30324@caradoc.them.org>
On Mon, Apr 28, 2008 at 08:39:51PM -0400, Daniel Jacobowitz wrote:
> On Tue, Apr 29, 2008 at 12:53:58AM +0200, Ulrich Weigand wrote:
> > - Extend elf_symtab_read to treat a synthetic symbol XXX@plt as a
> > mst_solib_trampoline symbol for XXX.
>
> Sounds reasonable. I suggested this to Aleksandar for another
> problem, even :-) Though it was kind of nice to have it show up in
> disassembly with @plt; will it still do that? It's nice to know
> immediately when I'm looking at the PLT stub instead of the
> definition.
This appears to work consistently, where by work I mean disassembly
shows the @plt sym but breakpoints on the undecorated version work
fine. I'm not sure exactly why; it may be luck. If it's luck
and someone cares later, we could make it work reliably by making
sure the @plt version has an accurate size and the non-@plt version
has size 0, or by making lookup_minimal_symbol_by_pc_section
explicitly prefer text to non-text symbols.
Hmm, thinking about this more, it probably won't work for your
case after all. lookup_solib_trampoline_symbol_by_pc will return
NULL if the first symbol we find is the text version.
What do you think? I wrote this because I need it to get some symbol
for malloc on Symbian, where I do not have a symbol file corresponding
to libc. The PLT entry works nicely for that purpose.
--
Daniel Jacobowitz
CodeSourcery
2008-05-02 Daniel Jacobowitz <dan@codesourcery.com>
* elfread.c (elf_symtab_read): Create trampolines for @plt symbols.
Index: symbian-fsf/gdb/elfread.c
===================================================================
--- symbian-fsf.orig/gdb/elfread.c 2008-05-02 16:56:20.000000000 -0400
+++ symbian-fsf/gdb/elfread.c 2008-05-02 17:34:42.000000000 -0400
@@ -521,6 +521,33 @@ elf_symtab_read (struct objfile *objfile
if (msym != NULL)
msym->filename = filesymname;
gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
+
+ /* For @plt symbols, also record a trampoline to the
+ destination symbol. The @plt symbol will be used in
+ disassembly, and the trampoline will be used when we are
+ trying to find the target. */
+ if (msym && ms_type == mst_text && type == ST_SYNTHETIC)
+ {
+ int len = strlen (sym->name);
+
+ if (len > 4 && strcmp (sym->name + len - 4, "@plt") == 0)
+ {
+ char *base_name = alloca (len - 4 + 1);
+ struct minimal_symbol *mtramp;
+
+ memcpy (base_name, sym->name, len - 4);
+ base_name[len - 4] = '\0';
+ mtramp = record_minimal_symbol (base_name, symaddr,
+ mst_solib_trampoline,
+ sym->section, objfile);
+ if (mtramp)
+ {
+ MSYMBOL_SIZE (mtramp) = MSYMBOL_SIZE (msym);
+ mtramp->filename = filesymname;
+ gdbarch_elf_make_msymbol_special (gdbarch, sym, mtramp);
+ }
+ }
+ }
}
}
}
next prev parent reply other threads:[~2008-05-02 21:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 2:38 Ulrich Weigand
2008-04-29 3:05 ` Daniel Jacobowitz
2008-04-29 15:59 ` Daniel Jacobowitz
2008-05-02 23:01 ` Daniel Jacobowitz [this message]
2008-05-02 23:25 ` Ulrich Weigand
2008-05-03 15:39 ` Daniel Jacobowitz
2008-05-03 15:59 ` Ulrich Weigand
2008-05-03 17:19 ` Daniel Jacobowitz
2008-05-14 18:25 ` Ulrich Weigand
2008-05-14 18:29 ` Daniel Jacobowitz
2008-05-14 21:38 ` Ulrich Weigand
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=20080502215132.GA12244@caradoc.them.org \
--to=drow@false.org \
--cc=amodra@bigpond.net.au \
--cc=bauerman@br.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/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