This is the mail archive of the
mailing list for the GDB project.
[PATCH] Don't set breakpoints on import stubs on Windows amd64
- From: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- To: gdb-patches at sourceware dot org
- Cc: Jon TURNEY <jon dot turney at dronecode dot org dot uk>
- Date: Fri, 6 Mar 2015 12:58:29 +0000
- Subject: [PATCH] Don't set breakpoints on import stubs on Windows amd64
- Authentication-results: sourceware.org; auth=none
On Windows i386, setting a breakpoint on a symbol imported from a shared library
(after that library is loaded) sets the breakpoint only in the shared library.
On Windows amd64, setting a breakpoint on a symbol imported from a shared
library (after that library is loaded) sets the breakpoint on both the import
stub, and in the shared library.
This appears to be due to the minimal symbol for the import stub not being
correctly given the type mst_solib_trampoline on Windows amd64, unlike Windows
This looks like an error in commit 303c5. It seems from this email  that
tests were only run on i386 at the time it was commited.
Note that as currently written, this is skipping over the character after the
"__imp_" (amd64) or "_imp_" (i386) prefix, assuming that it is '_'.
This patch removes that behaviour on amd64, and no characters are skipped over,
so the name of the import stub to mark as a trampoline is correctly constructed
from the import name (e.g the existence of '__imp_foo' implies that 'foo' in the
same object should be marked as a trampoline, rather than the probably
I'm not totally sure that asssumption that there will always be an '_' to skip
over on i386 is correct. Perhaps if the imported symbol is not C ABI (i.e. it's
an assembly routine), it doesn't have an '_' there?
Tested on x86_64-pc-cygwin
- FAIL: gdb.base/solib-symbol.exp: foo in libmd
+ PASS: gdb.base/solib-symbol.exp: foo in libmd
Unfortunately, several other tests are also affected. Some which failed because
setting a breakpoint on an imported symbol said "(2 locations)" now pass. Some
which passed now fail because this issue was masking other problems.
No change on i686-pc-cygwin.
2015-03-04 Jon TURNEY <firstname.lastname@example.org>
* coffread.c (coff_symfile_read): Fix construction of the name of
an import stub symbol from import symbol for amd64.
Signed-off-by: Jon TURNEY <email@example.com>
gdb/coffread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 366d828..21e7a77 100644
@@ -675,7 +675,7 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
&& (strncmp (name, "__imp_", 6) == 0
|| strncmp (name, "_imp_", 5) == 0))
- const char *name1 = (name == '_' ? &name : &name);
+ const char *name1 = &name;
struct bound_minimal_symbol found;
found = lookup_minimal_symbol (name1, NULL, objfile);