* [PATCH] Fix breakpoints on symbols with multiple trampoline symbols [not found] <20231106193047.2147-1-ssbssa.ref@yahoo.de> @ 2023-11-06 19:30 ` Hannes Domani 2023-11-21 17:28 ` Hannes Domani 2023-12-05 15:21 ` Tom Tromey 0 siblings, 2 replies; 5+ messages in thread From: Hannes Domani @ 2023-11-06 19:30 UTC (permalink / raw) To: gdb-patches 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 --- gdb/linespec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/linespec.c b/gdb/linespec.c index fa733d880e3..2aa01819812 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 ())) -- 2.35.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix breakpoints on symbols with multiple trampoline symbols 2023-11-06 19:30 ` [PATCH] Fix breakpoints on symbols with multiple trampoline symbols Hannes Domani @ 2023-11-21 17:28 ` Hannes Domani 2023-12-05 14:33 ` Hannes Domani 2023-12-05 15:21 ` Tom Tromey 1 sibling, 1 reply; 5+ messages in thread From: Hannes Domani @ 2023-11-21 17:28 UTC (permalink / raw) To: gdb-patches Ping. Am Montag, 6. November 2023, 20:31:22 MEZ hat Hannes Domani <ssbssa@yahoo.de> Folgendes geschrieben: > 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 > --- > gdb/linespec.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/gdb/linespec.c b/gdb/linespec.c > index fa733d880e3..2aa01819812 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 ())) > -- > 2.35.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix breakpoints on symbols with multiple trampoline symbols 2023-11-21 17:28 ` Hannes Domani @ 2023-12-05 14:33 ` Hannes Domani 0 siblings, 0 replies; 5+ messages in thread From: Hannes Domani @ 2023-12-05 14:33 UTC (permalink / raw) To: gdb-patches Ping. Am Dienstag, 21. November 2023, 18:28:28 MEZ hat Hannes Domani <ssbssa@yahoo.de> Folgendes geschrieben: > Ping. > > > Am Montag, 6. November 2023, 20:31:22 MEZ hat Hannes Domani <ssbssa@yahoo.de> Folgendes geschrieben: > > > 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 > > --- > > gdb/linespec.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/gdb/linespec.c b/gdb/linespec.c > > index fa733d880e3..2aa01819812 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 ())) > > -- > > 2.35.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix breakpoints on symbols with multiple trampoline symbols 2023-11-06 19:30 ` [PATCH] Fix breakpoints on symbols with multiple trampoline symbols Hannes Domani 2023-11-21 17:28 ` Hannes Domani @ 2023-12-05 15:21 ` Tom Tromey 2023-12-05 17:48 ` Hannes Domani 1 sibling, 1 reply; 5+ messages in thread From: Tom Tromey @ 2023-12-05 15:21 UTC (permalink / raw) To: Hannes Domani; +Cc: gdb-patches >>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes: Hannes> On mingw targets it's possible that there are multiple trampoline Hannes> symbols for __cxa_throw, in each module where a throw is done, but Hannes> without a corresponding global symbol. Hannes> Since commit 77f2120b200be6cabbf6f610942fc1173a8df6d3 they cancel each Hannes> other out in search_minsyms_for_name, which makes it impossible to set Hannes> a breakpoint there: Thank you for the patch. This is ok. Approved-By: Tom Tromey <tom@tromey.com> Tom ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix breakpoints on symbols with multiple trampoline symbols 2023-12-05 15:21 ` Tom Tromey @ 2023-12-05 17:48 ` Hannes Domani 0 siblings, 0 replies; 5+ messages in thread From: Hannes Domani @ 2023-12-05 17:48 UTC (permalink / raw) To: Tom Tromey; +Cc: gdb-patches Am Dienstag, 5. Dezember 2023, 16:21:58 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben: > >>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes: > > Hannes> On mingw targets it's possible that there are multiple trampoline > Hannes> symbols for __cxa_throw, in each module where a throw is done, but > Hannes> without a corresponding global symbol. > Hannes> Since commit 77f2120b200be6cabbf6f610942fc1173a8df6d3 they cancel each > Hannes> other out in search_minsyms_for_name, which makes it impossible to set > Hannes> a breakpoint there: > > Thank you for the patch. This is ok. > Approved-By: Tom Tromey <tom@tromey.com> Pushed, thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-05 17:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20231106193047.2147-1-ssbssa.ref@yahoo.de> 2023-11-06 19:30 ` [PATCH] Fix breakpoints on symbols with multiple trampoline symbols Hannes Domani 2023-11-21 17:28 ` Hannes Domani 2023-12-05 14:33 ` Hannes Domani 2023-12-05 15:21 ` Tom Tromey 2023-12-05 17:48 ` Hannes Domani
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).