Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [committed][gdb/testsuite] Fix FAILs due to PR gcc/101575
Date: Thu, 22 Jul 2021 14:37:40 +0200	[thread overview]
Message-ID: <20210722123738.GA23947@delia.home> (raw)

Hi,

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.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix FAILs due to PR gcc/101575

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/gdb.ada/formatted_ref.exp | 25 ++++++++++++++++++++++++-
 gdb/testsuite/gdb.ada/iwide.exp         | 25 +++++++++++++++++++++++--
 gdb/testsuite/gdb.ada/pkd_arr_elem.exp  | 26 ++++++++++++++++++++++++--
 3 files changed, 71 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/formatted_ref.exp b/gdb/testsuite/gdb.ada/formatted_ref.exp
index bc4b36309bd..ea4a7803198 100644
--- a/gdb/testsuite/gdb.ada/formatted_ref.exp
+++ b/gdb/testsuite/gdb.ada/formatted_ref.exp
@@ -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"]
 
diff --git a/gdb/testsuite/gdb.ada/iwide.exp b/gdb/testsuite/gdb.ada/iwide.exp
index 3bb854aad72..0742c504cbf 100644
--- a/gdb/testsuite/gdb.ada/iwide.exp
+++ b/gdb/testsuite/gdb.ada/iwide.exp
@@ -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\\)"
diff --git a/gdb/testsuite/gdb.ada/pkd_arr_elem.exp b/gdb/testsuite/gdb.ada/pkd_arr_elem.exp
index 31f78bddc39..2d644c60793 100644
--- a/gdb/testsuite/gdb.ada/pkd_arr_elem.exp
+++ b/gdb/testsuite/gdb.ada/pkd_arr_elem.exp
@@ -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

                 reply	other threads:[~2021-07-22 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210722123738.GA23947@delia.home \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox