[gdb/testsuite] Fix FAILs due to PR gcc/101575
authorTom de Vries <tdevries@suse.de>
Thu, 22 Jul 2021 15:21:21 +0000 (17:21 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 22 Jul 2021 15:21:21 +0000 (17:21 +0200)
When running test-case gdb.ada/formatted_ref.exp with gcc-11 and target board
unix/gdb:debug_flags=-gdwarf-4 we run into:
...
(gdb) print/x s^M
No definition of "s" in current context.^M
(gdb) FAIL: gdb.ada/formatted_ref.exp: print/x s
...
which is caused by "runto defs.adb:20" taking us to defs__struct1IP:
...
(gdb) break defs.adb:20^M
Breakpoint 1 at 0x402cfd: defs.adb:20. (2 locations)^M
(gdb) run ^M
Starting program: formatted_ref ^M
^M
Breakpoint 1, defs__struct1IP () at defs.adb:20^M
20            return s.x;                   -- Set breakpoint marker here.^M
(gdb) print s1'access^M
...
instead of the expected defs.f1:
...
(gdb) break defs.adb:20^M
Breakpoint 1 at 0x402d0e: file defs.adb, line 20.^M
(gdb) run ^M
Starting program: formatted_ref ^M
^M
Breakpoint 1, defs.f1 (s=...) at defs.adb:20^M
20            return s.x;                   -- Set breakpoint marker here.^M
...

This is caused by incorrect line info due to gcc PR 101575 - "[gcc-11,
-gdwarf-4] Missing .file <n> directive causes invalid line info".

Fix this by when landing in defs__struct1IP:
- xfailing the runto, and
- issuing a continue to land in defs.f1.

Likewise in a few other test-cases.

Tested on x86_64-linux, with:
- system gcc.
- gcc-11 and target boards unix/gdb:debug_flags=-gdwarf-4 and
  unix/gdb:debug_flags=-gdwarf-5.

gdb/testsuite/ChangeLog:

2021-07-22  Tom de Vries  <tdevries@suse.de>

* gdb.ada/formatted_ref.exp: Add xfail for PR gcc/101575.
* gdb.ada/iwide.exp: Same.
* gdb.ada/pkd_arr_elem.exp: Same.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/formatted_ref.exp
gdb/testsuite/gdb.ada/iwide.exp
gdb/testsuite/gdb.ada/pkd_arr_elem.exp

index 6574cc23adc99ddd0c9eeac2d0f464935c8bf855..ac96462e7ce4a3b78177ea89614901204a7c5353 100644 (file)
@@ -1,3 +1,9 @@
+2021-07-22  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.ada/formatted_ref.exp: Add xfail for PR gcc/101575.
+       * gdb.ada/iwide.exp: Same.
+       * gdb.ada/pkd_arr_elem.exp: Same.
+
 2021-07-22  Tom de Vries  <tdevries@suse.de>
 
        * gdb.cp/step-and-next-inline.cc (tree_check, get_alias_set, main):
index bc4b36309bdc7cab187096591e06a528c420fc89..ea4a7803198d511215e39c838f5e17907df3e900 100644 (file)
@@ -90,7 +90,30 @@ proc test_p_op1_equals_op2 {op1 op2} {
 
 clean_restart ${testfile}
 
-runto defs.adb:[gdb_get_line_number "marker here" ${testdir}/defs.adb ]
+set bp_location \
+    defs.adb:[gdb_get_line_number "marker here" ${testdir}/defs.adb]
+
+# Workaround gcc PR101575.
+#runto $bp_location
+gdb_breakpoint "$bp_location"
+gdb_run_cmd
+set re "Breakpoint $decimal, defs.f1 \\(.*\\) at .*:$decimal.*"
+set re_xfail "Breakpoint $decimal, defs__struct1IP \\(\\) at .*:$decimal.*"
+set ok 1
+gdb_test_multiple "" "Runto to $bp_location" {
+    -re -wrap $re {
+       if { $ok } {
+           pass $gdb_test_name
+       } else {
+           xfail $gdb_test_name
+       }
+    }
+    -re -wrap $re_xfail {
+       set ok 0
+       send_gdb "continue\n"
+       exp_continue
+    }
+}
 
 set s1_address  [get_address "s1"]
 
index 3bb854aad72517932416e7823a8a5d9c8bb25591..0742c504cbfa9b55e69c4a8e32a61473b6b31f55 100644 (file)
@@ -25,8 +25,29 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional
 
 clean_restart ${testfile}
 
-set bp_location [gdb_get_line_number "BREAK" ${testdir}/p.adb]
-runto "p.adb:$bp_location"
+set bp_location p.adb:[gdb_get_line_number "BREAK" ${testdir}/p.adb]
+
+# Workaround gcc PR101575.
+#runto "$bp_location"
+gdb_breakpoint "$bp_location"
+gdb_run_cmd
+set re "Breakpoint $decimal, p \\(\\) at .*:$decimal.*"
+set re_xfail "Breakpoint $decimal, p__P5b.0 \\(\\) at .*:$decimal.*"
+set ok 1
+gdb_test_multiple "" "Runto to $bp_location" {
+    -re -wrap $re {
+       if { $ok } {
+           pass $gdb_test_name
+       } else {
+           xfail $gdb_test_name
+       }
+    }
+    -re -wrap $re_xfail {
+       set ok 0
+       send_gdb "continue\n"
+       exp_continue
+    }
+}
 
 gdb_test "print My_Drawable" \
          "= \\(center => \\(x => 1, y => 2\\), radius => 3\\)"
index 31f78bddc39ae4506db0a6b6db0c0a15f96e2f97..2d644c60793480880b820d3c3d6b3e49e6a348b0 100644 (file)
@@ -25,8 +25,30 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
 
 clean_restart ${testfile}
 
-set bp_location [gdb_get_line_number "START" ${testdir}/failure.adb]
-runto "failure.adb:$bp_location"
+set bp_location \
+    failure.adb:[gdb_get_line_number "START" ${testdir}/failure.adb]
+
+# Workaround gcc PR101575.
+#runto "$bp_location"
+gdb_breakpoint "$bp_location"
+gdb_run_cmd
+set re "Breakpoint $decimal, failure \\(\\) at .*:$decimal.*"
+set re_xfail "Breakpoint $decimal, failure__bounded_funny_stringIP.0 \\(\\) at .*:$decimal.*"
+set ok 1
+gdb_test_multiple "" "Runto to $bp_location" {
+    -re -wrap $re {
+       if { $ok } {
+           pass $gdb_test_name
+       } else {
+           xfail $gdb_test_name
+       }
+    }
+    -re -wrap $re_xfail {
+       set ok 0
+       send_gdb "continue\n"
+       exp_continue
+    }
+}
 
 # Print Test.  The order of the components depends on which version of
 # the compiler being used, as newer version can re-order the order
This page took 0.056107 seconds and 4 git commands to generate.