aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2023-12-05 18:41:44 +0100
committerHannes Domani <ssbssa@yahoo.de>2023-12-05 18:46:18 +0100
commit6e28dd6fa3027d38351d2cf672509eca05aa19fd (patch)
tree6b6ccfdf20dc812e3e54df64dbb7cdb90bb36086
parent66e00622a89a0fd1c37539a72c6cdd7c6bd334e7 (diff)
downloadfsf-binutils-gdb-6e28dd6fa3027d38351d2cf672509eca05aa19fd.zip
fsf-binutils-gdb-6e28dd6fa3027d38351d2cf672509eca05aa19fd.tar.gz
fsf-binutils-gdb-6e28dd6fa3027d38351d2cf672509eca05aa19fd.tar.bz2
Fix breakpoints on symbols with multiple trampoline symbols
On mingw targets it's possible that there are multiple trampoline symbols for __cxa_throw, in each module where a throw is done, but without a corresponding global symbol. Since commit 77f2120b200be6cabbf6f610942fc1173a8df6d3 they cancel each other out in search_minsyms_for_name, which makes it impossible to set a breakpoint there: (gdb) b __cxa_throw Function "__cxa_throw" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 2 (__cxa_throw) pending. (gdb) c Continuing. [Inferior 1 (process 10004) exited with code 03] With catch throw it also doesn't work, and you don't even get an error message: (gdb) catch throw Catchpoint 2 (throw) (gdb) c Continuing. [Inferior 1 (process 5532) exited with code 03] (gdb) The fix is to simply ignore other trampoline symbols when looking for corresponding global symbols, and it's working as expected: (gdb) b __cxa_throw Breakpoint 2 at 0x13f091590 (2 locations) (gdb) c Continuing. Breakpoint 2.1, 0x000000013f091590 in __cxa_throw () (gdb) And catch throw also works again: (gdb) catch throw Catchpoint 2 (throw) (gdb) c Continuing. Catchpoint 2.1 (exception thrown), 0x000000013f181590 in __cxa_throw () (gdb) Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29548 Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r--gdb/linespec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index fa733d8..2aa0181 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -4281,6 +4281,10 @@ search_minsyms_for_name (struct collect_info *info,
if (&item2 == &item)
continue;
+ /* Ignore other trampoline symbols. */
+ if (item2.minsym->type () == mst_solib_trampoline)
+ continue;
+
/* Trampoline symbols can only jump to exported
symbols. */
if (msymbol_type_is_static (item2.minsym->type ()))