* lib/gdb.exp (GDBFLAGS): Move -nx ...

(INTERNAL_GDBFLAGS): ... to here.  Move -nw to here as well.
	(default_gdb_version): Add $INTERNAL_GDBFLAGS to gdb invocations.
	(default_gdb_start,default_gdb_exit): Ditto.
	* lib/mi-support.exp (default_mi_gdb_start): Ditto.
	(mi_uncatched_gdb_exit): Add $INTERNAL_GDBFLAGS to log message.
	* gdb.base/corefile.exp: Add $INTERNAL_GDBFLAGS to gdb invocations.
	* gdb.base/dbx.exp (dbx_gdb_start): Ditto.
	* gdb.base/args.exp (GDBFLAGS): Don't overwrite, append.
	* gdb.base/remotetimeout.exp (GDBFLAGS): Ditto.
This commit is contained in:
Doug Evans 2008-11-11 01:23:34 +00:00
parent 7bae733213
commit 6b8ce72729
7 changed files with 51 additions and 32 deletions

View File

@ -1,3 +1,16 @@
2008-11-10 Doug Evans <dje@google.com>
* lib/gdb.exp (GDBFLAGS): Move -nx ...
(INTERNAL_GDBFLAGS): ... to here. Move -nw to here as well.
(default_gdb_version): Add $INTERNAL_GDBFLAGS to gdb invocations.
(default_gdb_start,default_gdb_exit): Ditto.
* lib/mi-support.exp (default_mi_gdb_start): Ditto.
(mi_uncatched_gdb_exit): Add $INTERNAL_GDBFLAGS to log message.
* gdb.base/corefile.exp: Add $INTERNAL_GDBFLAGS to gdb invocations.
* gdb.base/dbx.exp (dbx_gdb_start): Ditto.
* gdb.base/args.exp (GDBFLAGS): Don't overwrite, append.
* gdb.base/remotetimeout.exp (GDBFLAGS): Ditto.
2008-11-03 Andreas Schwab <schwab@suse.de>
* gdb.base/hashline2.exp: Fix typo.

View File

@ -71,7 +71,8 @@ proc args_test { name arglist } {
# Test that the --args are processed correctly.
#
set old_gdbflags $GDBFLAGS
set GDBFLAGS "-nx --args $binfile 1 3"
set GDBFLAGS "$old_gdbflags --args $binfile 1 3"
args_test basic {{1} {3}}
#
@ -79,21 +80,21 @@ args_test basic {{1} {3}}
# The syntax needed is a little peculiar; DejaGNU treats the arguments as a
# list and expands them itself, since no shell redirection is involved.
#
set GDBFLAGS "-nx --args $binfile 1 {} 3"
set GDBFLAGS "$old_gdbflags --args $binfile 1 {} 3"
args_test "one empty" {{1} {} {3}}
#
# try with 2 empty args
#
set GDBFLAGS "-nx --args $binfile 1 {} {} 3"
set GDBFLAGS "$old_gdbflags --args $binfile 1 {} {} 3"
args_test "two empty" {{1} {} {} 3}
# Try with arguments containing literal single quotes.
set GDBFLAGS "-nx --args $binfile 1 '' 3"
set GDBFLAGS "$old_gdbflags --args $binfile 1 '' 3"
args_test "one empty (with single quotes)" {{1} {''} {3}}
set GDBFLAGS "-nx --args $binfile 1 '' '' 3"
set GDBFLAGS "$old_gdbflags --args $binfile 1 '' '' 3"
args_test "two empty (with single quotes)" {{1} {''} {''} {3}}
# try with arguments containing literal newlines.

View File

@ -105,10 +105,7 @@ if { $found == 0 } {
# To do this, we must shutdown the currently running gdb and restart
# with the -core args. We can't use gdb_start because it looks for
# the first gdb prompt, and the message we are looking for occurs
# before the first prompt. Also, we can't include GDBFLAGS because
# if it is empty, this confuses gdb with an empty argument that it
# grumbles about (said grumbling currently being ignored in gdb_start).
# **FIXME**
# before the first prompt.
#
# Another problem is that on some systems (solaris for example), there
# is apparently a limit on the length of a fully specified path to
@ -117,13 +114,13 @@ if { $found == 0 } {
gdb_exit
if $verbose>1 then {
send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile\n"
}
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
verbose "Timeout is now $timeout seconds" 2
eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile"
expect {
-re "Couldn't find .* registers in core file.*$gdb_prompt $" {
fail "args: -core=corefile (couldn't find regs)"
@ -150,11 +147,11 @@ expect {
close;
if $verbose>1 then {
send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
}
eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: execfile -core=corefile"

View File

@ -48,11 +48,11 @@ if { [gdb_compile "${binfile1}.o ${binfile2}.o" ${binfile} executable {debug}]
proc dbx_gdb_start { } {
global verbose
global GDB
global GDBFLAGS
global INTERNAL_GDBFLAGS GDBFLAGS
global prompt
global spawn_id
global timeout
verbose "Spawning $GDB -nw $GDBFLAGS"
verbose "Spawning $GDB -dbx $INTERNAL_GDBFLAGS $GDBFLAGS"
if { [which $GDB] == 0 } then {
perror "$GDB does not exist."
@ -61,7 +61,7 @@ proc dbx_gdb_start { } {
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
eval "spawn $GDB -nw -dbx $GDBFLAGS"
eval "spawn $GDB -dbx $INTERNAL_GDBFLAGS $GDBFLAGS"
gdb_expect {
-re ".*\r\n$gdb_prompt $" {
verbose "GDB initialized."

View File

@ -34,7 +34,7 @@ if [target_info exists noargs] {
# Test that -l is processed correctly.
#
set old_gdbflags $GDBFLAGS
set GDBFLAGS "-l 42"
set GDBFLAGS "$GDBFLAGS -l 42"
gdb_exit
gdb_start
gdb_test "show remotetimeout" \

View File

@ -42,12 +42,20 @@ if ![info exists GDB] {
}
verbose "using GDB = $GDB" 2
# GDBFLAGS is available for the user to set on the command line.
# E.g. make check RUNTESTFLAGS=GDBFLAGS=mumble
# Testcases may use it to add additional flags, but they must:
# - append new flags, not overwrite
# - restore the original value when done
global GDBFLAGS
if ![info exists GDBFLAGS] {
set GDBFLAGS "-nx"
set GDBFLAGS ""
}
verbose "using GDBFLAGS = $GDBFLAGS" 2
# INTERNAL_GDBFLAGS contains flags that the testsuite requires.
set INTERNAL_GDBFLAGS "-nw -nx"
# The variable gdb_prompt is a regexp which matches the gdb prompt.
# Set it if it is not already set.
global gdb_prompt
@ -94,22 +102,22 @@ set octal "\[0-7\]+"
#
proc default_gdb_version {} {
global GDB
global GDBFLAGS
global INTERNAL_GDBFLAGS GDBFLAGS
global gdb_prompt
set fileid [open "gdb_cmd" w];
puts $fileid "q";
close $fileid;
set cmdfile [remote_download host "gdb_cmd"];
set output [remote_exec host "$GDB -nw --command $cmdfile"]
set output [remote_exec host "$GDB $INTERNAL_GDBFLAGS --command $cmdfile"]
remote_file build delete "gdb_cmd";
remote_file host delete "$cmdfile";
set tmp [lindex $output 1];
set version ""
regexp " \[0-9\]\[^ \t\n\r\]+" "$tmp" version
if ![is_remote host] {
clone_output "[which $GDB] version $version $GDBFLAGS\n"
clone_output "[which $GDB] version $version $INTERNAL_GDBFLAGS $GDBFLAGS\n"
} else {
clone_output "$GDB on remote host version $version $GDBFLAGS\n"
clone_output "$GDB on remote host version $version $INTERNAL_GDBFLAGS $GDBFLAGS\n"
}
}
@ -1010,7 +1018,7 @@ proc gdb_reinitialize_dir { subdir } {
#
proc default_gdb_exit {} {
global GDB
global GDBFLAGS
global INTERNAL_GDBFLAGS GDBFLAGS
global verbose
global gdb_spawn_id;
@ -1020,7 +1028,7 @@ proc default_gdb_exit {} {
return;
}
verbose "Quitting $GDB $GDBFLAGS"
verbose "Quitting $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
if { [is_remote host] && [board_info host exists fileid] } {
send_gdb "quit\n";
@ -1150,14 +1158,14 @@ proc gdb_file_cmd { arg } {
proc default_gdb_start { } {
global verbose
global GDB
global GDBFLAGS
global INTERNAL_GDBFLAGS GDBFLAGS
global gdb_prompt
global timeout
global gdb_spawn_id;
gdb_stop_suppressing_tests;
verbose "Spawning $GDB -nw $GDBFLAGS"
verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS"
if [info exists gdb_spawn_id] {
return 0;
@ -1169,7 +1177,7 @@ proc default_gdb_start { } {
exit 1
}
}
set res [remote_spawn host "$GDB -nw $GDBFLAGS [host_info gdb_opts]"];
set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]"];
if { $res < 0 || $res == "" } {
perror "Spawning $GDB failed."
return 1;

View File

@ -39,7 +39,7 @@ proc mi_gdb_exit {} {
proc mi_uncatched_gdb_exit {} {
global GDB
global GDBFLAGS
global INTERNAL_GDBFLAGS GDBFLAGS
global verbose
global gdb_spawn_id;
global gdb_prompt
@ -56,7 +56,7 @@ proc mi_uncatched_gdb_exit {} {
return;
}
verbose "Quitting $GDB $GDBFLAGS $MIFLAGS"
verbose "Quitting $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS"
if { [is_remote host] && [board_info host exists fileid] } {
send_gdb "999-gdb-exit\n";
@ -94,7 +94,7 @@ proc mi_uncatched_gdb_exit {} {
proc default_mi_gdb_start { args } {
global verbose
global GDB
global GDBFLAGS
global INTERNAL_GDBFLAGS GDBFLAGS
global gdb_prompt
global mi_gdb_prompt
global timeout
@ -116,7 +116,7 @@ proc default_mi_gdb_start { args } {
sid_start
}
verbose "Spawning $GDB -nw $GDBFLAGS $MIFLAGS"
verbose "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS"
if [info exists gdb_spawn_id] {
return 0;
@ -138,7 +138,7 @@ proc default_mi_gdb_start { args } {
set mi_inferior_tty_name $spawn_out(slave,name)
}
set res [remote_spawn host "$GDB -nw $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];
set res [remote_spawn host "$GDB $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];
if { $res < 0 || $res == "" } {
perror "Spawning $GDB failed."
return 1;