[PATCHv2] gdb/mi: New commands to catch C++ exceptions

Eli Zaretskii eliz@gnu.org
Sun May 12 04:09:00 GMT 2019


> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,
> 	Tom Tromey <tom@tromey.com>,
> 	Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Sun, 12 May 2019 00:46:46 +0100
> 
> Eli,
> 
> This iteration includes updated documentation that fixes almost all of
> the issues you raised.  The only thing I haven't done is collapse all
> of the command sub-sections into a single sub-section.  I looked
> through most of the existing MI commands and they all seem to be one
> command per sub-section, so I wasn't entirely sure how to layout a
> merged entry, nor if a merged entry was inline with the style for MI
> commands.

Understood.

> +The following @sc{gdb/mi} commands can be used to create catchpoints
> +that stop the execution when C@t{++} exceptions are being throw, rethrown,
> +or caught..
            ^^
Extra period.

> +@smallexample
> +-catch-throw -r exception_type
> +^done,bkpt=@{number="1",type="breakpoint",disp="keep",enabled="y",
> +  addr="0x00000000004006c0",what="exception throw",
> +  catch-type="throw",thread-groups=["i1"],
> +  regexp="exception_type",times="0"@}
> +(gdb)
> +-exec-run
> +^running
> +(gdb)
> +~"\n"
> +~"Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed
> +  in __cxa_throw () from /lib64/libstdc++.so.6\n"
> +*stopped,bkptno="1",reason="breakpoint-hit",disp="keep",
> +  frame=@{addr="0x00007ffff7ae00ed",func="__cxa_throw",
> +  args=[],from="/lib64/libstdc++.so.6",arch="i386:x86-64"@},
> +  thread-id="1",stopped-threads="all",core="6"
> +(gdb)
> +@end smallexample

So what GDB shows when the catchpoint triggers doesn't include the
exception's type, is that right?  That's a pity; I expected it to show
the type, which could then be compared against the regexp.  Oh well.

> +~"Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed

It says "thrown" both for "throw" and "rethrow"?  So there's no way to
distinguish between these two?

> +~"Catchpoint 1 (exception thrown), 0x00007ffff7ae00ed

And the same here? not "exception caught"?

The documentation parts are OK, thanks.



More information about the Gdb-patches mailing list