This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Move -nx from GDBFLAGS to INTERNAL_GDBFLAGS in testsuite
- From: dje at google dot com (Doug Evans)
- To: gdb-patches at sourceware dot org
- Date: Tue, 21 Oct 2008 12:05:00 -0700 (PDT)
- Subject: [RFA] Move -nx from GDBFLAGS to INTERNAL_GDBFLAGS in testsuite
Hi. GDBFLAGS is currently available for users to override on the command
line. But it also contains flags required by the testsuite (-nx).
The recently fixed bug to args.exp (by adding -nx to GDBFLAGS) originated
because GDBFLAGS was being overwritten instead of appended to (like many
other testcases do).
This patch does two things:
- clarifies GDBFLAGS usage
- moves required flags out of GDBFLAGS and into INTERNAL_GDBFLAGS
Another approach is to not have INTERNAL_GDBFLAGS and just hardwire -nx
everywhere, but the current approach seems cleaner.
OTOH, maybe -nw should be moved to INTERNAL_GDBFLAGS too. Dunno.
Tested on i686-linux.
Ok to check in?
2008-10-21 Doug Evans <dje@google.com>
* lib/gdb.exp (GDBFLAGS): Move -nx ...
(INTERNAL_GDBFLAGS): ... to here.
(default_gdb_version): Add $INTERNAL_GDBFLAGS to gdb invocations.
(default_gdb_start): 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/args.exp (GDBFLAGS): Don't overwrite, append.
* gdb.base/remotetimeout.exp (GDBFLAGS): Ditto.
Index: testsuite/gdb.base/args.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/args.exp,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 args.exp
--- testsuite/gdb.base/args.exp 8 Aug 2008 17:17:02 -0000 1.15
+++ testsuite/gdb.base/args.exp 21 Oct 2008 18:30:42 -0000
@@ -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}}
set GDBFLAGS $old_gdbflags
Index: testsuite/gdb.base/corefile.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/corefile.exp,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 corefile.exp
--- testsuite/gdb.base/corefile.exp 6 Aug 2008 12:52:07 -0000 1.15
+++ testsuite/gdb.base/corefile.exp 21 Oct 2008 18:30:42 -0000
@@ -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 -nw $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 -nw $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 -nw $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
}
-eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
+eval "spawn $GDB -nw $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"
Index: testsuite/gdb.base/remotetimeout.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/remotetimeout.exp,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 remotetimeout.exp
--- testsuite/gdb.base/remotetimeout.exp 1 Jan 2008 22:53:19 -0000 1.4
+++ testsuite/gdb.base/remotetimeout.exp 21 Oct 2008 18:30:42 -0000
@@ -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" \
Index: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.107
diff -u -p -u -p -r1.107 gdb.exp
--- testsuite/lib/gdb.exp 13 Sep 2008 17:54:06 -0000 1.107
+++ testsuite/lib/gdb.exp 21 Oct 2008 18:30:42 -0000
@@ -42,12 +42,21 @@ 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.
+# ??? Perhaps -nw should go here too. Dunno.
+set INTERNAL_GDBFLAGS "-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 +103,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 -nw $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 +1019,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 +1029,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 +1159,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 -nw $INTERNAL_GDBFLAGS $GDBFLAGS"
if [info exists gdb_spawn_id] {
return 0;
@@ -1169,7 +1178,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 -nw $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]"];
if { $res < 0 || $res == "" } {
perror "Spawning $GDB failed."
return 1;
Index: testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.74
diff -u -p -u -p -r1.74 mi-support.exp
--- testsuite/lib/mi-support.exp 22 Sep 2008 11:00:41 -0000 1.74
+++ testsuite/lib/mi-support.exp 21 Oct 2008 18:30:42 -0000
@@ -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 -nw $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 -nw $INTERNAL_GDBFLAGS $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];
if { $res < 0 || $res == "" } {
perror "Spawning $GDB failed."
return 1;