public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: use gdb_test_multiple in gdb_breakpoint
@ 2023-01-03 19:22 Simon Marchi
  2023-01-04  9:15 ` Lancelot SIX
  2023-01-05  9:04 ` Tom de Vries
  0 siblings, 2 replies; 19+ messages in thread
From: Simon Marchi @ 2023-01-03 19:22 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

When running the testsuite in a non-optimized build on a slow machine, I
sometimes get:

    UNTESTED: gdb.gdb/selftest.exp: Cannot set breakpoint at captured_main, skipping testcase.

do_self_tests, in lib/selftest-support.exp, uses `with_timeout_factor
10`, to account for the fact that reading the debug info of the gdb
binary (especially in a non-optimized GDB) can take time.  But then it
ends up calling gdb_breakpoint, which uses gdb_expect with a hard-coded
timeout of 30 seconds.

Fix this by making gdb_breakpoint use gdb_test_multiple, which is a
desired change anyway for this kind of simple command / expected
output case.

Change-Id: I9b06ce991cc584810d8cc231b2b4893980b8be75
---
 gdb/testsuite/lib/gdb.exp | 32 +-------------------------------
 1 file changed, 1 insertion(+), 31 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 135ace68d5ed..5a0cd46d8998 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -641,9 +641,8 @@ proc gdb_breakpoint { linespec args } {
 
     set test_name "gdb_breakpoint: set breakpoint at $linespec"
 
-    send_gdb "$break_command $linespec\n"
     # The first two regexps are what we get with -g, the third is without -g.
-    gdb_expect 30 {
+    gdb_test_multiple "$break_command $linespec" "" {
 	-re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
 	-re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
 	-re "$break_message \[0-9\]* at .*$gdb_prompt $" {}
@@ -659,35 +658,6 @@ proc gdb_breakpoint { linespec args } {
 		send_gdb "$pending_response\n"
 		exp_continue
 	}
-	-re "A problem internal to GDB has been detected" {
-		if { $print_fail } {
-		    fail "$test_name (GDB internal error)"
-		}
-		gdb_internal_error_resync
-		return 0
-	}
-	-re "$gdb_prompt $" {
-		if { $print_fail } {
-			fail $test_name
-		}
-		return 0
-	}
-	eof {
-		perror "GDB process no longer exists"
-		global gdb_spawn_id
-		set wait_status [wait -i $gdb_spawn_id]
-		verbose -log "GDB process exited with wait status $wait_status"
-		if { $print_fail } {
-			fail "$test_name (eof)"
-		}
-		return 0
-	}
-	timeout {
-		if { $print_fail } {
-			fail "$test_name (timeout)"
-		}
-		return 0
-	}
     }
     if { $print_pass } {
 	pass $test_name

base-commit: a7d5fcaf8e15820f997ba7774a8eef7ab7e2f2e3
-- 
2.39.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-01-11 19:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03 19:22 [PATCH] gdb: use gdb_test_multiple in gdb_breakpoint Simon Marchi
2023-01-04  9:15 ` Lancelot SIX
2023-01-04 16:11   ` Simon Marchi
2023-01-04 16:18     ` Lancelot SIX
2023-01-04 16:22       ` Simon Marchi
2023-01-04 17:40         ` Lancelot SIX
2023-01-04 18:02           ` Lancelot SIX
2023-01-04 19:05             ` Simon Marchi
2023-01-04 19:12               ` Lancelot SIX
2023-01-05  9:04 ` Tom de Vries
2023-01-05 16:28   ` Simon Marchi
2023-01-05 16:31     ` Tom de Vries
2023-01-05 16:36       ` Simon Marchi
2023-01-10 15:33     ` Pedro Alves
2023-01-10 15:50       ` Simon Marchi
2023-01-10 19:56         ` Pedro Alves
2023-01-10 20:42           ` Simon Marchi
2023-01-11 19:05             ` Pedro Alves
2023-01-11 19:42               ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).