+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
# 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
}
}
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
if { $MIFLAGS == "-i=mi1" } {
perror "(mi startup) Got unexpected new mi prompt."
remote_close host
+ unset gdb_spawn_id
return -1
}
verbose "GDB initialized."
if { $MIFLAGS != "-i=mi1" } {
perror "(mi startup) Got unexpected old mi prompt."
remote_close host
+ unset gdb_spawn_id
return -1
}
verbose "GDB initialized."
-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