[gdb/testsuite] Require use_gdb_stub == 0 where appropriate

When running with target board native-gdbserver, we run into a number of FAILs
due to use of the start command (and similar), which is not supported when
use_gdb_stub == 1.

Fix this by:
- requiring use_gdb_stub == 0 for the entire test-case, or
- guarding some tests in the test-case with use_gdb_stub == 0.

Tested on x86_64-linux.
This commit is contained in:
Tom de Vries 2021-10-13 11:06:36 +02:00
parent 36170420e3
commit 2786ef85fa
6 changed files with 34 additions and 16 deletions

View file

@ -25,6 +25,9 @@
# Because of (1), the test has to be written in assembly with explicit CFI
# directives.
# Check if starti command is supported.
require use_gdb_stub 0
load_lib dwarf.exp
if {![dwarf2_support]} {

View file

@ -25,6 +25,9 @@ if { !([isnative] && [istarget *-linux*]) } then {
return
}
# Check if start command is supported.
require use_gdb_stub 0
# The plan is for async mode to become the default but toggle for now.
set saved_gdbflags $GDBFLAGS
set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]

View file

@ -539,22 +539,25 @@ gdb_test "print \$cvar3" "= void" \
# "show commands".
gdb_test "python gdb.execute(\"show commands\")" "$decimal print \\\$cvar3.*"
# Test that the from_tty argument to gdb.execute is effective. If
# False, the user is not prompted for decisions such as restarting the
# program, and "yes" is assumed. If True, the user is prompted.
# Case 1, from_tty=False.
gdb_test "python gdb.execute('starti', from_tty=False)" \
"Program stopped.*" \
"starti via gdb.execute, not from tty"
# Check if starti command is supported.
if { [use_gdb_stub] == 0 } {
# Test that the from_tty argument to gdb.execute is effective. If
# False, the user is not prompted for decisions such as restarting the
# program, and "yes" is assumed. If True, the user is prompted.
# Case 1, from_tty=False.
gdb_test "python gdb.execute('starti', from_tty=False)" \
"Program stopped.*" \
"starti via gdb.execute, not from tty"
# Case 2, from_tty=True.
set test "starti via gdb.execute, from tty"
set question \
[multi_line \
{The program being debugged has been started already\.} \
{Start it from the beginning\? \(y or n\) $}]
gdb_test_multiple "python gdb.execute('starti', from_tty=True)" $test {
-re $question {
gdb_test "y" "Starting program:.*" $gdb_test_name
# Case 2, from_tty=True.
set test "starti via gdb.execute, from tty"
set question \
[multi_line \
{The program being debugged has been started already\.} \
{Start it from the beginning\? \(y or n\) $}]
gdb_test_multiple "python gdb.execute('starti', from_tty=True)" $test {
-re $question {
gdb_test "y" "Starting program:.*" $gdb_test_name
}
}
}

View file

@ -17,6 +17,9 @@ if ![supports_reverse] {
return
}
# Check if start command is supported.
require use_gdb_stub 0
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \

View file

@ -25,6 +25,9 @@
# layout must show the contents of f2.c.
# 7. Going back to main() shall result in no contents again.
# Check if start command is supported.
require use_gdb_stub 0
tuiterm_env
standard_testfile

View file

@ -8251,6 +8251,9 @@ proc require { fn arg1 {arg2 ""} } {
"ensure_gdb_index $binfile -dwarf-5 != -1" {
set msg "Couldn't ensure index in binfile"
}
"use_gdb_stub == 0" {
set msg "Remote stub used"
}
default { set msg "$fn != $val" }
}