aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-03-15 09:03:14 -0600
committerTom Tromey <tromey@adacore.com>2022-04-04 12:28:31 -0600
commit81eaa5061095f972d48e8160a4f677bd3e6ace51 (patch)
tree7e10646f2c2844fa23f4467d3bfa812db88bc6e5 /gdb/testsuite
parent59dfe8ad84c6a9ef17a1ba4a8f443ac3cb9f6fd5 (diff)
downloadgdb-81eaa5061095f972d48e8160a4f677bd3e6ace51.zip
gdb-81eaa5061095f972d48e8160a4f677bd3e6ace51.tar.gz
gdb-81eaa5061095f972d48e8160a4f677bd3e6ace51.tar.bz2
Handle ghost entities in symbol lookup
Normally, SPARK ghost entities are removed from the executable. However, with -gnata, they will be preserved. In this situation, it's handy to be able to inspect them. This patch allows this by removing the "___ghost_" prefix in the appropriate places.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.ada/ghost.exp37
-rw-r--r--gdb/testsuite/gdb.ada/ghost/gpck.ads18
-rw-r--r--gdb/testsuite/gdb.ada/ghost/main.adb22
-rw-r--r--gdb/testsuite/gdb.ada/ghost/pck.ads19
4 files changed, 96 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/ghost.exp b/gdb/testsuite/gdb.ada/ghost.exp
new file mode 100644
index 0000000..7f92b13
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ghost.exp
@@ -0,0 +1,37 @@
+# Copyright 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 main
+
+set flags [list debug additional_flags=-gnata]
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != "" } {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "START" ${testdir}/main.adb]
+if ![runto "main.adb:$bp_location" ] then {
+ perror "Couldn't run ${testfile}"
+ return
+}
+
+gdb_test "print value" " = 64 '@'"
+gdb_test "print ghost_value" " = 64 '@'"
+gdb_test "print value2" " = 33 '!'"
diff --git a/gdb/testsuite/gdb.ada/ghost/gpck.ads b/gdb/testsuite/gdb.ada/ghost/gpck.ads
new file mode 100644
index 0000000..5a38ed4
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ghost/gpck.ads
@@ -0,0 +1,18 @@
+-- Copyright 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/>.
+
+package GPck with Ghost is
+ Value2 : Character := '!';
+end GPck;
diff --git a/gdb/testsuite/gdb.ada/ghost/main.adb b/gdb/testsuite/gdb.ada/ghost/main.adb
new file mode 100644
index 0000000..7da2542
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ghost/main.adb
@@ -0,0 +1,22 @@
+-- Copyright 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/>.
+
+with Pck; use Pck;
+with GPck; use GPck;
+
+procedure Main with Ghost is
+begin
+ null; -- START
+end Main;
diff --git a/gdb/testsuite/gdb.ada/ghost/pck.ads b/gdb/testsuite/gdb.ada/ghost/pck.ads
new file mode 100644
index 0000000..f56aa50
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ghost/pck.ads
@@ -0,0 +1,19 @@
+-- Copyright 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/>.
+
+package Pck is
+ Value : Character := '@';
+ Ghost_Value : Character := '@' with Ghost;
+end Pck;