[PATCH] GDB: Fix test case gdb.base/valgrind-bt.exp.

Carl Love cel@us.ibm.com
Fri Apr 16 18:15:24 GMT 2021


GDB maintainers:

The following patch fixes gdb tests errors with Valgrind in the test
gdb.base/valgrind-bt.exp.  The patch fixes an issue with the wait time
in the lib/valgrind.exp as well.  The lib fix also fixes test errors in
the gdb.base/valgrind-disp-step.exp and valgrind-infcall.exp.

The patch has been run on prototype ISA 3.1 hardware, Power 9 and Power
8BE.

Please let me know if the patch is acceptable to commit.

                      Carl build_plt_stub


---------------------------------------------------
[PATCH] Fix test case gdb.base/valgrind-bt.exp.

gdb/testsuite/ChangeLog:

	* gdb.base/valgrind-bt.exp: Add gdb_test "break main".
	Update expected string for gdb_test "bt".

	* lib/valgrind.exp: Increase vgdb wait from 1 to 5.
---
 gdb/testsuite/gdb.base/valgrind-bt.exp | 4 +++-
 gdb/testsuite/lib/valgrind.exp         | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.base/valgrind-bt.exp b/gdb/testsuite/gdb.base/valgrind-bt.exp
index bc6b0a384dd..206aa6360e6 100644
--- a/gdb/testsuite/gdb.base/valgrind-bt.exp
+++ b/gdb/testsuite/gdb.base/valgrind-bt.exp
@@ -31,6 +31,8 @@ if { [vgdb_start] == -1 } {
 
 set double_free [gdb_get_line_number "double-free"]
 
+gdb_test "break main" "Breakpoint 1 at 0x\[0-9a-fA-F\]+: file .*valgrind-bt.c, line \[0-9\]+." "Set bk in main"
+
 set test "continue"
 gdb_test_multiple "continue" $test {
     -re "Invalid free\\(\\).*: main \\(${srcfile}:$double_free\\)\r\n.*$gdb_prompt $" {
@@ -57,7 +59,7 @@ gdb_test_multiple "continue" $test {
 gdb_test_no_output "set height 0"
 gdb_test_no_output "set width 0"
 
-gdb_test "bt" "in main \\(.*\\) at .*${srcfile}:$double_free"
+gdb_test "bt" "#\[0-9 ]+main \\(.*\\) at .*${srcfile}.*"
 
 # Explicitly kill the program so it doesn't dump core when we quit->detach.
 gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
diff --git a/gdb/testsuite/lib/valgrind.exp b/gdb/testsuite/lib/valgrind.exp
index c214491f7b8..5e0eaa33ee8 100644
--- a/gdb/testsuite/lib/valgrind.exp
+++ b/gdb/testsuite/lib/valgrind.exp
@@ -87,7 +87,7 @@ proc vgdb_start { {active_at_startup 1} } {
     # gdbserver and connect to it.
     gdb_test "disconnect" ".*"
 
-    set vgdbcmd "target remote | vgdb --wait=1 --pid=$vgdbpid"
+    set vgdbcmd "target remote | vgdb --wait=5 --pid=$vgdbpid"
     if { $active_at_startup } {
 	gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
     } else {
-- 
2.27.0




More information about the Gdb-patches mailing list