Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Move -nx from GDBFLAGS to INTERNAL_GDBFLAGS in testsuite
Date: Tue, 11 Nov 2008 04:11:00 -0000	[thread overview]
Message-ID: <e394668d0811101726h3a4bb5dej34099c9a6c51edad@mail.gmail.com> (raw)
In-Reply-To: <20081109164733.GA5112@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

On Sun, Nov 9, 2008 at 8:47 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> Any other comments?  Can I check it in after moving -nw into
>> INTERNAL_GDBCFLAGS?
>
> Yes. Just remember to post the patch that you eventually check in.
>
> Thank you,
> --
> Joel

Here's the patch I checked in.

[-- Attachment #2: gdb-081110-gdbflags-1.patch.txt --]
[-- Type: text/plain, Size: 10791 bytes --]

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.

Index: gdb.base/args.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/args.exp,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 args.exp
--- gdb.base/args.exp	30 Oct 2008 10:07:16 -0000	1.16
+++ gdb.base/args.exp	11 Nov 2008 01:15:00 -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}}
 
 # try with arguments containing literal newlines.
Index: 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
--- gdb.base/corefile.exp	6 Aug 2008 12:52:07 -0000	1.15
+++ gdb.base/corefile.exp	11 Nov 2008 01:15:01 -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 $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"
Index: gdb.base/dbx.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/dbx.exp,v
retrieving revision 1.12
diff -u -p -u -p -r1.12 dbx.exp
--- gdb.base/dbx.exp	6 Aug 2008 12:52:07 -0000	1.12
+++ gdb.base/dbx.exp	11 Nov 2008 01:15:01 -0000
@@ -48,11 +48,11 @@ if  { [gdb_compile "${binfile1}.o ${binf
 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."
Index: 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
--- gdb.base/remotetimeout.exp	1 Jan 2008 22:53:19 -0000	1.4
+++ gdb.base/remotetimeout.exp	11 Nov 2008 01:15:01 -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: 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
--- lib/gdb.exp	13 Sep 2008 17:54:06 -0000	1.107
+++ lib/gdb.exp	11 Nov 2008 01:15:01 -0000
@@ -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;
Index: lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.75
diff -u -p -u -p -r1.75 mi-support.exp
--- lib/mi-support.exp	23 Oct 2008 23:11:21 -0000	1.75
+++ lib/mi-support.exp	11 Nov 2008 01:15:01 -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 $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;

      reply	other threads:[~2008-11-11  1:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 19:06 Doug Evans
2008-10-27 12:52 ` Pedro Alves
2008-10-30  3:08   ` Joel Brobecker
2008-11-07 22:43     ` Doug Evans
2008-11-09 16:48       ` Joel Brobecker
2008-11-11  4:11         ` Doug Evans [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e394668d0811101726h3a4bb5dej34099c9a6c51edad@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox