binutils-gdb/gdb/testsuite/gdb.ada/widewide.exp
Tom Tromey d32cbc04e3 Add another test for Ada Wide_Wide_String
In an earlier patch, I had written that I wanted to add this test:

      ptype Wide_Wide_String'("literal")

... but that it failed with the distro GNAT.  Further investigation
showed that it could be made to work by adding a function using
Wide_Wide_String to the program -- this caused the type to end up in
the debug info.

This patch adds the test.  I'm checking this in.
2022-03-17 06:46:13 -06:00

65 lines
2.0 KiB
Plaintext

# Copyright 2011-2022 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"
if { [skip_ada_tests] } { return -1 }
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
return -1
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
if ![runto "foo.adb:$bp_location" ] then {
perror "Couldn't run ${testfile}"
return
}
gdb_test "print some_easy" "= 74 'J'"
gdb_test "print some_larger" "= 48879 '\\\[\"00beef\"\\\]'"
gdb_test "print some_big" "= 14335727 '\\\[\"dabeef\"\\\]'"
gdb_test "print my_wws" "= \" helo\""
gdb_test "print my_wws(1)" "= 32 ' '"
gdb_test "print my_wws(2)" "= 104 'h'"
gdb_test "print my_wws = \" helo\"" " = true"
gdb_test "print my_ws = \"wide\"" " = true"
gdb_test "print my_ws = \"nope\"" " = false"
gdb_test "print \"x\" & my_ws & \"y\"" " = \"xwidey\""
gdb_test "print my_wws(1..3) := \"abc\"" " = \"abc\""
gdb_test "print my_wws" " = \"abclo\"" \
"print my_wws after slice assignment"
gdb_test "print my_wws(1..3) := my_wws(2..4)" " = \"bcl\""
gdb_test "print my_wws" " = \"bcllo\"" \
"print my_wws after overlapping slice assignment"
gdb_test "print 'x' & my_ws" " = \"xwide\""
gdb_test "print my_ws & 'y'" " = \"widey\""
gdb_test "ptype wide_wide_string'(\"wws\")" \
"array \\(1 \\.\\. 3\\) of wide_wide_character"