public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* "catch throw" vs. "b __cxa_throw"
@ 2022-08-12 20:51 Tom Kacvinsky
  2022-08-15 11:10 ` Andrew Burgess
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Kacvinsky @ 2022-08-12 20:51 UTC (permalink / raw)
  To: gdb

We happened to notice that with gdb 7.6.1, "catch throw" caught an exception
(a logic_error exception from initializing a std::string with nullptr).
However, with
GDB 11.1 and 12.1 (I have not tested earlier versions than that), we did
not break
on the exception when using "catch throw".  However, I was able to break
when
I used "b __cxa_throw"

I looked in sourceware's bugzilla for a report on this, but I didn't see
anything.
I also perused the code and from what I could gather, "catch throw"
basically
mapped to setting a breakpoint on __cxa_throw.  I did not figure out the
logic
for "catch throw" in the GDB 12.1 source.

What is really odd is that "catch throw" works fine for some small examples,
but the use case I have where it is not working is our full blown project
(a mix
of C, C++ and Ada) and I wouldn't know where to begin constructing an MRE.

Any ideas as to what is going on with this?

Thanks,

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "catch throw" vs. "b __cxa_throw"
  2022-08-12 20:51 "catch throw" vs. "b __cxa_throw" Tom Kacvinsky
@ 2022-08-15 11:10 ` Andrew Burgess
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Burgess @ 2022-08-15 11:10 UTC (permalink / raw)
  To: Tom Kacvinsky, gdb

Tom Kacvinsky via Gdb <gdb@sourceware.org> writes:

> We happened to notice that with gdb 7.6.1, "catch throw" caught an exception
> (a logic_error exception from initializing a std::string with nullptr).
> However, with
> GDB 11.1 and 12.1 (I have not tested earlier versions than that), we did
> not break
> on the exception when using "catch throw".  However, I was able to break
> when
> I used "b __cxa_throw"
>
> I looked in sourceware's bugzilla for a report on this, but I didn't see
> anything.
> I also perused the code and from what I could gather, "catch throw"
> basically
> mapped to setting a breakpoint on __cxa_throw.  I did not figure out the
> logic
> for "catch throw" in the GDB 12.1 source.
>
> What is really odd is that "catch throw" works fine for some small examples,
> but the use case I have where it is not working is our full blown project
> (a mix
> of C, C++ and Ada) and I wouldn't know where to begin constructing an MRE.
>
> Any ideas as to what is going on with this?

No clue what's going wrong here, but you could use 'maint info
breakpoints' to discover the exact address where the 'catch throw' has
placed a breakpoint.

From that you might be able to figure out why you're hitting your
breakpoint, but not the 'catch throw' breakpoint.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-15 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 20:51 "catch throw" vs. "b __cxa_throw" Tom Kacvinsky
2022-08-15 11:10 ` Andrew Burgess

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).