commands that we, as developers, believe would be close to a minimal
set of commands for a new user of GDB.
+* Debugger Adapter Protocol changes
+
+ ** Unhandled Ada exceptions can now be caught using the "unhandled"
+ exception filter.
+
* Changed remote packets
single-inf-arg in qSupported
@in_gdb_thread
def _catch_exception(filterId, **args):
- if filterId in ("assert", "exception", "throw", "rethrow", "catch"):
+ if filterId == "unhandled":
+ cmd = ["-catch-exception", "-u"]
+ elif filterId in ("assert", "exception", "throw", "rethrow", "catch"):
cmd = ["-catch-" + filterId]
else:
raise DAPException("Invalid exception filterID: " + str(filterId))
"label": "Ada exceptions",
"supportsCondition": True,
},
+ {
+ "filter": "unhandled",
+ "label": "Ada exceptions without a handler",
+ "supportsCondition": True,
+ },
{
"filter": "throw",
"label": "C++ exceptions, when thrown",
--- /dev/null
+# Copyright 2025 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib ada.exp
+load_lib dap-support.exp
+
+require allow_ada_tests allow_dap_tests gnat_runtime_has_debug_info
+
+standard_ada_testfile prog
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable debug] != ""} {
+ return -1
+}
+
+if {[dap_initialize] == ""} {
+ return
+}
+
+set launch_id [dap_launch $testfile]
+
+set obj [dap_check_request_and_response "set exception catchpoints" \
+ setExceptionBreakpoints \
+ {o filters [a [s unhandled]]}]
+
+set bps [dict get [lindex $obj 0] body breakpoints]
+gdb_assert {[llength $bps] == 1} "one breakpoint"
+
+dap_check_request_and_response "configurationDone" configurationDone
+
+dap_check_response "launch response" launch $launch_id
+
+dap_wait_for_event_and_check "stopped at unhandled exception" stopped \
+ "body reason" breakpoint \
+ "body hitBreakpointIds" 1
+
+dap_shutdown
--- /dev/null
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body Pck is
+ procedure Throw_Something (Val : Integer) is
+ begin
+ raise Program_Error;
+ end Throw_Something;
+end Pck;
--- /dev/null
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Pck is
+ procedure Throw_Something (Val : Integer);
+end Pck;
--- /dev/null
+-- Copyright 2025 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Pck; use Pck;
+
+procedure Prog is
+begin
+ Throw_Something (23);
+end Prog;