diff options
author | Pedro Alves <pedro@palves.net> | 2020-09-13 20:31:25 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2020-09-13 20:31:25 +0100 |
commit | 2f4b83cd51953fdf9626dc7a198b35505d1f5472 (patch) | |
tree | a88028733218de22e23db0d0025bb6363c8984d0 | |
parent | c49da0e466e1bcb6e1f363ea4a806cfd2c322cb0 (diff) | |
download | gdb-2f4b83cd51953fdf9626dc7a198b35505d1f5472.zip gdb-2f4b83cd51953fdf9626dc7a198b35505d1f5472.tar.gz gdb-2f4b83cd51953fdf9626dc7a198b35505d1f5472.tar.bz2 |
Make default_mi_gdb_start/dbx_gdb_start use gdb_spawn
If a board file wants to customize how gdb is launched, the obvious
way is to have the board override gdb_spawn. However, that doesn't
work for either gdb.mi/ testcases or gdb.base/dbx.exp, because
default_mi_gdb_start and dbx_gdb_start don't use gdb_spawn currently.
That is fixed by this patch.
gdb/testsuite/
* gdb.base/dbx.exp (dbx_gdb_start): Adjust to use gdb_spawn
instead of spawning GDB with remote_spawn.
* lib/mi-support.exp (default_mi_gdb_start): Adjust to use
gdb_spawn instead of spawning GDB with remote_spawn.
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/dbx.exp | 18 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 27 |
3 files changed, 30 insertions, 22 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0744c1e..397c616 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,12 @@ 2020-09-13 Pedro Alves <pedro@palves.net> + * gdb.base/dbx.exp (dbx_gdb_start): Adjust to use gdb_spawn + instead of spawning GDB with remote_spawn. + * lib/mi-support.exp (default_mi_gdb_start): Adjust to use + gdb_spawn instead of spawning GDB with remote_spawn. + +2020-09-13 Pedro Alves <pedro@palves.net> + * gdb.dwarf2/ada-linkage-name.c (main): Move to the bottom of the file and add calls to first and second. * gdb.dwarf2/atomic.c (main): Move to the bottom of the file and diff --git a/gdb/testsuite/gdb.base/dbx.exp b/gdb/testsuite/gdb.base/dbx.exp index 2a53f99..5228f2e 100644 --- a/gdb/testsuite/gdb.base/dbx.exp +++ b/gdb/testsuite/gdb.base/dbx.exp @@ -26,31 +26,33 @@ if {[build_executable $testfile.exp $testfile \ # start gdb -- start gdb running, default procedure # proc dbx_gdb_start { } { - global GDB - global INTERNAL_GDBFLAGS GDBFLAGS global prompt - global spawn_id global timeout - verbose "Spawning $GDB -dbx $INTERNAL_GDBFLAGS $GDBFLAGS" + global gdb_spawn_id - if { [which $GDB] == 0 } then { - perror "$GDB does not exist." - exit 1 + save_vars { GDBFLAGS } { + append GDBFLAGS " -dbx" + + set res [gdb_spawn] + if { $res != 0} { + return $res + } } set oldtimeout $timeout set timeout [expr "$timeout + 60"] - eval "spawn $GDB -dbx $INTERNAL_GDBFLAGS $GDBFLAGS" gdb_expect { -re ".*\r\n$gdb_prompt $" { verbose "GDB initialized." } -re "$prompt $" { perror "GDB never initialized." + unset gdb_spawn_id return -1 } timeout { perror "(timeout) GDB never initialized." + unset gdb_spawn_id return -1 } } diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 7c1dcd6..5c1fcca 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -226,24 +226,19 @@ proc default_mi_gdb_start { args } { sid_start } - verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS" - if [info exists gdb_spawn_id] { return 0 } - if ![is_remote host] { - if { [which $GDB] == 0 } then { - perror "$GDB does not exist." - exit 1 + save_vars { GDBFLAGS } { + append GDBFLAGS " $MIFLAGS" + + set res [gdb_spawn] + if { $res != 0} { + return $res } } - set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS [host_info gdb_opts]"] - if { $res < 0 || $res == "" } { - perror "Spawning $GDB failed." - return 1 - } gdb_expect { -re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" { # We have a new format mi startup prompt. If we are @@ -252,6 +247,7 @@ proc default_mi_gdb_start { args } { if { $MIFLAGS == "-i=mi1" } { perror "(mi startup) Got unexpected new mi prompt." remote_close host + unset gdb_spawn_id return -1 } verbose "GDB initialized." @@ -263,6 +259,7 @@ proc default_mi_gdb_start { args } { if { $MIFLAGS != "-i=mi1" } { perror "(mi startup) Got unexpected old mi prompt." remote_close host + unset gdb_spawn_id return -1 } verbose "GDB initialized." @@ -270,22 +267,24 @@ proc default_mi_gdb_start { args } { -re ".*unrecognized option.*for a complete list of options." { untested "skip mi tests (not compiled with mi support)." remote_close host + unset gdb_spawn_id return -1 } -re ".*Interpreter `mi' unrecognized." { untested "skip mi tests (not compiled with mi support)." remote_close host + unset gdb_spawn_id return -1 } timeout { perror "(timeout) GDB never initialized after 10 seconds." remote_close host + unset gdb_spawn_id return -1 } } - set gdb_spawn_id $res - set gdb_main_spawn_id $res - set mi_spawn_id $res + set gdb_main_spawn_id $gdb_spawn_id + set mi_spawn_id $gdb_spawn_id # FIXME: mi output does not go through pagers, so these can be removed. # force the height to "unlimited", so no pagers get used |