** Unhandled Ada exceptions can now be caught using the "unhandled"
exception filter.
+ ** The launch and attach requests now accept the adaSourceCharset
+ parameter.
+
* Changed remote packets
single-inf-arg in qSupported
parameters common to both:
@table @code
+@item adaSourceCharset
+If provided, this is a string that is used to set the Ada source
+character set. @xref{Ada Source Character Set}.
+
@item program
If provided, this is a string that specifies the program to use. This
corresponds to the @code{file} command. @xref{Files}.
env: Optional[Mapping[str, str]] = None,
stopAtBeginningOfMainSubprogram: bool = False,
stopOnEntry: bool = False,
+ adaSourceCharset: Optional[str] = None,
**extra,
):
# Launch setup is handled here. This is done synchronously so
# that errors can be reported in a natural way.
@in_gdb_thread
def _setup_launch():
+ if adaSourceCharset is not None:
+ exec_and_log("set ada source-charset " + adaSourceCharset)
if cwd is not None:
exec_and_log("cd " + cwd)
if program is not None:
program: Optional[str] = None,
pid: Optional[int] = None,
target: Optional[str] = None,
+ adaSourceCharset: Optional[str] = None,
**args,
):
# The actual attach is handled by this function.
@in_gdb_thread
def _do_attach():
+ if adaSourceCharset is not None:
+ exec_and_log("set ada source-charset " + adaSourceCharset)
if program is not None:
file_command(program)
if pid is not None:
--- /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_dap_tests
+require allow_ada_tests
+
+# Enable basic use of UTF-8. LC_ALL gets reset for each testfile.
+setenv LC_ALL C.UTF-8
+
+standard_ada_testfile prog
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
+ {debug additional_flags=-gnatW8}] != ""} {
+ return
+}
+
+if {[dap_initialize] == ""} {
+ return
+}
+
+set launch_id [dap_launch $testfile ada_source_charset UTF-8]
+
+set line [gdb_get_line_number "BREAK"]
+set obj [dap_check_request_and_response "set breakpoint by line number" \
+ setBreakpoints \
+ [format {o source [o path [%s]] breakpoints [a [o line [i %d]]]} \
+ [list s $srcfile] $line]]
+set line_bpno [dap_get_breakpoint_number $obj]
+
+dap_check_request_and_response "configurationDone" configurationDone
+
+dap_check_response "launch response" launch $launch_id
+
+dap_wait_for_event_and_check "inferior started" thread "body reason" started
+
+dap_wait_for_event_and_check "stopped at line breakpoint" stopped \
+ "body reason" breakpoint \
+ "body hitBreakpointIds" $line_bpno
+
+set bt [lindex [dap_check_request_and_response "backtrace" stackTrace \
+ {o threadId [i 1]}] \
+ 0]
+set frame_id [dict get [lindex [dict get $bt body stackFrames] 0] id]
+
+set scopes [dap_check_request_and_response "get scopes" scopes \
+ [format {o frameId [i %d]} $frame_id]]
+set scopes [dict get [lindex $scopes 0] body scopes]
+
+# This is what the implementation does, so we can assume it, but check
+# just in case something changes.
+lassign $scopes locals regs _ignore
+gdb_assert {[dict get $locals name] == "Locals"} "local scope"
+gdb_assert {[dict get $regs name] == "Registers"} "register scope"
+
+set num_vars [dict get $locals namedVariables]
+gdb_assert {$num_vars == 1} "correct number of locals"
+
+set num [dict get $locals variablesReference]
+set refs [lindex [dap_check_request_and_response "fetch variables" \
+ "variables" \
+ [format {o variablesReference [i %d] count [i %d]} \
+ $num $num_vars]] \
+ 0]
+
+foreach var [dict get $refs body variables] {
+ set name [dict get $var name]
+
+ # It doesn't matter what case is used for the variable name (GNAT
+ # upcases these Greek letters whereas it downcases Latin), and it
+ # doesn't matter if Python chooses to emit the character itself or
+ # a Unicode escape. Therefore allow all of these.
+ switch -nocase -- $name {
+ "\\u03a0" -
+ "\\u03a6" -
+ "Π" -
+ "π" {
+ # Ok.
+ }
+ default {
+ fail "unknown variable $name"
+ }
+ }
+}
+
+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 Pack is
+
+ procedure Do_Nothing (A : System.Address) is
+ begin
+ null;
+ end Do_Nothing;
+
+end Pack;
--- /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 System;
+package Pack is
+ procedure Do_Nothing (A : System.Address);
+end Pack;
--- /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 Pack; use Pack;
+
+procedure Prog is
+ π : Integer := 3; -- The Indiana Approximation.
+begin
+ Do_Nothing (π'Address); -- BREAK
+end Prog;
# "stopAtBeginningOfMainSubprogram" will be passed to the launch
# request.
# * cwd - value is the working directory to use.
+# * ada_source_charset - value is passed as adaSourceCharset
#
# After this proc is called, gdb will be ready to accept breakpoint
# requests.
append envlist " cwd [format {[%s]} [list s $value]]"
}
+ ada_source_charset {
+ append envlist " adaSourceCharset [format {[%s]} [list s $value]]"
+ }
+
default {
error "unrecognized parameter $key"
}