From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix up msymbol type of dll trampoline to mst_solib_trampoline
Date: Thu, 18 Jul 2013 03:26:00 -0000 [thread overview]
Message-ID: <51E76040.2030202@codesourcery.com> (raw)
In-Reply-To: <51E74E2D.3040806@codesourcery.com>
On 07/18/2013 10:08 AM, Yao Qi wrote:
>
> Committed.
>
Forget to attach the patch. Here is it.
--
Yao (é½å°§)
gdb:
2013-07-18 Yao Qi <yao@codesourcery.com>
* coffread.c (coff_symfile_read): Iterate over minimal symbols,
if the name is prefixed by "__imp_" or "_imp_", look for minimal
symbol without prefix. If found, set its type to
'mst_solib_trampoline'.
---
gdb/coffread.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index bf39085..1402247 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -650,6 +650,35 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
install_minimal_symbols (objfile);
+ if (pe_file)
+ {
+ struct minimal_symbol *msym;
+
+ ALL_OBJFILE_MSYMBOLS (objfile, msym)
+ {
+ const char *name = SYMBOL_LINKAGE_NAME (msym);
+
+ /* If the minimal symbols whose name are prefixed by "__imp_"
+ or "_imp_", get rid of the prefix, and search the minimal
+ symbol in OBJFILE. Note that 'maintenance print msymbols'
+ shows that type of these "_imp_XXXX" symbols is mst_data. */
+ if (MSYMBOL_TYPE (msym) == mst_data
+ && (strncmp (name, "__imp_", 6) == 0
+ || strncmp (name, "_imp_", 5) == 0))
+ {
+ const char *name1 = (name[1] == '_' ? &name[7] : &name[6]);
+ struct minimal_symbol *found;
+
+ found = lookup_minimal_symbol (name1, NULL, objfile);
+ /* If found, there are symbols named "_imp_foo" and "foo"
+ respectively in OBJFILE. Set the type of symbol "foo"
+ as 'mst_solib_trampoline'. */
+ if (found != NULL && MSYMBOL_TYPE (found) == mst_text)
+ MSYMBOL_TYPE (found) = mst_solib_trampoline;
+ }
+ }
+ }
+
/* Free the installed minimal symbol data. */
do_cleanups (cleanup_minimal_symbols);
--
1.7.7.6
prev parent reply other threads:[~2013-07-18 3:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 4:24 Yao Qi
2013-06-27 20:43 ` Tom Tromey
2013-06-28 7:37 ` Yao Qi
2013-06-28 15:58 ` Tom Tromey
2013-07-03 0:26 ` Yao Qi
2013-07-05 8:44 ` asmwarrior
2013-07-05 12:22 ` Yao Qi
2013-07-05 14:30 ` Eli Zaretskii
2013-07-06 7:21 ` Yao Qi
2013-07-06 7:41 ` Eli Zaretskii
2013-07-06 8:20 ` asmwarrior
2013-07-10 6:21 ` Yao Qi
2013-07-10 16:56 ` Tom Tromey
2013-07-18 2:09 ` Yao Qi
2013-07-18 3:26 ` Yao Qi [this message]
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=51E76040.2030202@codesourcery.com \
--to=yao@codesourcery.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