Add DAP support for C++ exceptions

This adds DAP support for the various C++ exception-catching
operations.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30682
This commit is contained in:
Tom Tromey
2023-07-25 10:48:13 -06:00
parent 21db866dc6
commit af93035b27
3 changed files with 119 additions and 4 deletions

View File

@ -353,10 +353,8 @@ def set_insn_breakpoints(
@in_gdb_thread
def _catch_exception(filterId, **args):
if filterId == "assert":
cmd = "-catch-assert"
elif filterId == "exception":
cmd = "-catch-exception"
if filterId in ("assert", "exception", "throw", "rethrow", "catch"):
cmd = "-catch-" + filterId
else:
raise Exception(f"Invalid exception filterID: {filterId}")
result = gdb.execute_mi(cmd)
@ -404,6 +402,21 @@ def _rewrite_exception_breakpoint(
"label": "Ada exceptions",
"supportsCondition": True,
},
{
"filter": "throw",
"label": "C++ exceptions, when thrown",
"supportsCondition": True,
},
{
"filter": "rethrow",
"label": "C++ exceptions, when re-thrown",
"supportsCondition": True,
},
{
"filter": "catch",
"label": "C++ exceptions, when caught",
"supportsCondition": True,
},
),
)
def set_exception_breakpoints(