aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.linespec
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-06-26 08:49:40 +0200
committerTom de Vries <tdevries@suse.de>2024-06-26 08:49:40 +0200
commitc44008bda2fdc743312b0f6e56198ea0a8cfd079 (patch)
tree8d83bd4b779096ab9064155d6dd9034fd1b4e4b7 /gdb/testsuite/gdb.linespec
parentf8ed9c5722d465f5a3dd5c6cb5616e3d92014727 (diff)
downloadgdb-c44008bda2fdc743312b0f6e56198ea0a8cfd079.zip
gdb-c44008bda2fdc743312b0f6e56198ea0a8cfd079.tar.gz
gdb-c44008bda2fdc743312b0f6e56198ea0a8cfd079.tar.bz2
[gdb/testsuite] Fix timeout in gdb.base/bg-execution-repeat.exp
I ran into the following test failure with test-case gdb.base/bg-execution-repeat.exp: ... (gdb) PASS: gdb.base/bg-execution-repeat.exp: c&: repeat bg command ^M Breakpoint 2, foo () at bg-execution-repeat.c:23^M 23 return 0; /* set break here */^M print 1^M $1 = 1^M (gdb) PASS: gdb.base/bg-execution-repeat.exp: c&: input still accepted FAIL: gdb.base/bg-execution-repeat.exp: c&: breakpoint hit 2 (timeout) ... The failure can be easily reproduced by adding a sleep 5 here: ... + sleep 5 gdb_test "print 1" " = 1" "input still accepted" ... There's a race in the test-case, between: - the command handled in the foreground: the "print 1" command, and - the command handled in the background: the continue command. The current way of dealing with this is by putting the inferior to sleep for 5 seconds: ... foo (); sleep (5); foo (); ... with the aim that the "print 1" command will win the race. This method is both slow and unreliable. Fix this by making the inferior wait till the "print 1" command is done. This reduces running time from ~11s to ~1s. I also verified that the test-case still triggers on the original problem by applying this gdb/infcmd.c patch: ... -strip_bg_char (const char *args, int *bg_char_p) +strip_bg_char (const char *_args, int *bg_char_p) { - const char *p; + char *args = const_cast<char *>(_args); + char *p; if (args == nullptr || *args == '\0') { @@ -210,6 +211,7 @@ strip_bg_char (const char *args, int *bg_char_p) p--; while (p > args && isspace (p[-1])) p--; + *p = '\0'; ... Tested on x86_64-linux, with make-check-all.sh. PR testsuite/31794 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31794 Reviewed-By: Guinevere Larsen <blarsen@redhat.com>
Diffstat (limited to 'gdb/testsuite/gdb.linespec')
0 files changed, 0 insertions, 0 deletions