diff options
author | Yao Qi <yao@codesourcery.com> | 2013-07-18 01:45:15 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-07-18 01:45:15 +0000 |
commit | 303c5ee1872e455db7728fb6b432f74e44ce3393 (patch) | |
tree | 5597945a071994a2ac8c51237490730323d3df5a /gdb/coffread.c | |
parent | 3631583d25f0d7e97a514fc78a5bfecb85af1066 (diff) | |
download | gdb-303c5ee1872e455db7728fb6b432f74e44ce3393.zip gdb-303c5ee1872e455db7728fb6b432f74e44ce3393.tar.gz gdb-303c5ee1872e455db7728fb6b432f74e44ce3393.tar.bz2 |
gdb/
* 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'.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | 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); |