+2012-09-08  Khoo Yit Phang  <khooyp@cs.umd.edu>
+
+       Replace -nw option with $INTERNAL_GDBFLAGS in "xgdb" tests to
+       avoid spurious results due to ~/.gdbinit.
+       * gdb.gdb/complaint.exp (setup_test): Replace -nw option with
+       $INTERNAL_GDBFLAGS in run command.
+       * gdb.gdb/observer.exp (setup_test): Ditto.
+       * gdb.gdb/selftest.exp (test_with_self): Ditto.
+       * gdb.gdb/xfullpath.exp (setup_test): Ditto.
+
 2012-09-06  Doug Evans  <dje@google.com>
 
        * boards/fission.exp: New file.
 
 proc setup_test { executable } {
     global gdb_prompt
     global timeout
+    global INTERNAL_GDBFLAGS
 
     # load yourself into the debugger
     # This can take a relatively long time, particularly for testing where
     set timeout 600
 
     set description "run until breakpoint at captured_command_loop"
-    gdb_test_multiple "run -nw" "$description" {
+    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
         -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.* at .*main.c:.*$gdb_prompt $" {
             pass "$description"
         }
 
 proc setup_test { executable } {
     global gdb_prompt
     global timeout
+    global INTERNAL_GDBFLAGS
 
     # load yourself into the debugger
     # This can take a relatively long time, particularly for testing where
     set timeout 600
 
     set description "run until breakpoint at captured_main"
-    gdb_test_multiple "run -nw" "$description" {
+    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
         -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
             pass "$description"
         }
 
     global det_file
     global decimal
     global timeout
+    global INTERNAL_GDBFLAGS
 
     # load yourself into the debugger
     # This can take a relatively long time, particularly for testing where
     set timeout 600
 
     set description "run until breakpoint at captured_main"
-    gdb_test_multiple "run -nw" "$description" {
+    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
            pass "$description"
        }
 
 proc setup_test { executable } {
     global gdb_prompt
     global timeout
+    global INTERNAL_GDBFLAGS
 
     # load yourself into the debugger
     # This can take a relatively long time, particularly for testing where
     set timeout 600
 
     set description "run until breakpoint at captured_main"
-    gdb_test_multiple "run -nw" "$description" {
+    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
         -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
             pass "$description"
         }