aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param.exp25
-rw-r--r--gdb/testsuite/lib/ada.exp36
-rw-r--r--gdb/testsuite/lib/gnat_debug_info_test.adb6
4 files changed, 71 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 488196c..31208bd 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-27 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * lib/ada.exp (gnat_runtime_has_debug_info): New proc.
+ * lib/gnat_debug_info_test.adb: New file.
+ * gdb.ada/ptype_tagged_param.exp: Use
+ gnat_runtime_has_debug_info, expect a different output if
+ runtime does not have debug info.
+
2019-12-20 Simon Marchi <simon.marchi@efficios.com>
* lib/sym-info-cmds.exp (GDBInfoSymbols::check_no_entry): Add
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
index 567ef82..08d3e5d 100644
--- a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
@@ -21,14 +21,31 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" }
return -1
}
+set has_runtime_debug_info [gnat_runtime_has_debug_info]
+
clean_restart ${testfile}
if ![runto "position_x" ] then {
return -1
}
-set eol "\[\r\n\]+"
-set sp "\[ \t\]*"
+# Identifying the runtime type of S can only be done when we have the debug
+# info for the GNAT runtime.
+
+if { $has_runtime_debug_info } {
+ gdb_test "ptype s" \
+ [multi_line \
+ "type = <ref> new pck.shape with record" \
+ " r: integer;" \
+ "end record"] \
+ "ptype s, with debug info"
+} else {
+ gdb_test "ptype s" \
+ [multi_line \
+ "type = <ref> tagged record" \
+ " x: integer;" \
+ " y: integer;" \
+ "end record" ] \
+ "ptype s, without debug info"
+}
-gdb_test "ptype s" \
- "type = <ref> new pck.shape with record${eol}${sp}r: integer;${eol}end record"
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 45c4180..6f5961a 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -149,3 +149,39 @@ proc gnatmake_version_at_least { major } {
# Unknown, return 1
return 1
}
+
+# Return 1 if the GNAT runtime appears to have debug info.
+
+gdb_caching_proc gnat_runtime_has_debug_info {
+ global srcdir
+
+ set src "$srcdir/lib/gnat_debug_info_test.adb"
+ set dst [standard_output_file "gnat_debug_info_test"]
+
+ if { [gdb_compile_ada $src $dst executable {debug}] != "" } {
+ fail "failed to compile gnat-debug-info test binary"
+ return 0
+ }
+
+ clean_restart $dst
+
+ if { ! [runto "GNAT_Debug_Info_Test"] } {
+ fail "failed to run to GNAT_Debug_Info_Test"
+ return 0
+ }
+
+ set has_debug_info 0
+
+ gdb_test_multiple "whatis __gnat_debug_raise_exception" "" {
+ -re "type = <text variable, no debug info>" { }
+ -re "type = void" {
+ set has_debug_info 1
+ }
+ default {
+ # Some other unexpected output...
+ fail $gdb_test_name
+ }
+ }
+
+ return $has_debug_info
+}
diff --git a/gdb/testsuite/lib/gnat_debug_info_test.adb b/gdb/testsuite/lib/gnat_debug_info_test.adb
new file mode 100644
index 0000000..b8f0b03
--- /dev/null
+++ b/gdb/testsuite/lib/gnat_debug_info_test.adb
@@ -0,0 +1,6 @@
+with Ada.Text_IO;
+
+procedure GNAT_Debug_Info_Test is
+begin
+ Ada.Text_IO.Put_Line("Hello, world!");
+end GNAT_Debug_Info_Test;