This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/testsuite]: Stop dbx.exp insanity


There were two issues with dbx.exp which could cause hard-to-identify
testsuite failures:

  - It reimplemented gdb_file_cmd and left it changed.  This means that the
    behavior of tests varied based on whether they ran before or after
    dbx.exp.
  - The reimplemented gdb_file_cmd was buggy in and of itself.

The attached patch has been verified to fix both things.  I restore the old
gdb_file_cmd after dbx.exp is done; and for kicks I ran the testsuite
without the line that restores it and verified that the other bugs were
gone.  The problem was forgetting to call exec-file in some cases.


Fernando, is this OK to commit?



Two examples in particular.  This is the one inexplicable failure caused by
my stabs line-numbering patch:

Running ../../../src/gdb/testsuite/gdb.base/dbx.exp ...
Running ../../../src/gdb/testsuite/gdb.base/reread.exp ...
FAIL: gdb.base/reread.exp: second pass: breakpoint foo in first file

# of unexpected failures        1


vs.

Running ../../../src/gdb/testsuite/gdb.base/reread.exp ...

(no failures)


Here's one in dump.exp:

Running ../../../src/gdb/testsuite/gdb.base/dbx.exp ...
Running ../../../src/gdb/testsuite/gdb.base/dump.exp ...
FAIL: gdb.base/dump.exp: reload array as value, srec
FAIL: gdb.base/dump.exp: reload struct as value, srec
FAIL: gdb.base/dump.exp: reload array as memory, srec
FAIL: gdb.base/dump.exp: reload struct as memory, srec
FAIL: gdb.base/dump.exp: reload array as value, intel hex
FAIL: gdb.base/dump.exp: reload struct as value, intel hex
FAIL: gdb.base/dump.exp: reload array as memory, intel hex
FAIL: gdb.base/dump.exp: reload struct as memory, intel hex
FAIL: gdb.base/dump.exp: reload array as value, tekhex
FAIL: gdb.base/dump.exp: reload struct as value, tekhex
FAIL: gdb.base/dump.exp: reload array as memory, tekhex
FAIL: gdb.base/dump.exp: reload struct as memory, tekhex

vs.

Running ../../../src/gdb/testsuite/gdb.base/dump.exp ...

(no failures)


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


2002-03-30  Daniel Jacobowitz  <drow@mvista.com>

	* gdb.base/dbx.exp: Restore old definition of gdb_file_cmd
	when finished.  Make gdb_file_cmd send "exec-file" when
	appropriate.

Index: dbx.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/dbx.exp,v
retrieving revision 1.3
diff -u -r1.3 dbx.exp
--- dbx.exp	2001/05/23 19:04:13	1.3
+++ dbx.exp	2002/03/30 19:27:00
@@ -168,6 +168,11 @@
 # file into gdb for a dbx session. So why not just override gdb_file_cmd with the
 # right sequence of events, allowing gdb_load to do its normal thing? This way
 # remotes and simulators will work, too.
+#
+# [drow 2002-03-30]: We can restore the old gdb_file_cmd afterwards, though.
+set old_gdb_file_cmd_args [info args gdb_file_cmd]
+set old_gdb_file_cmd_body [info body gdb_file_cmd]
+
 proc gdb_file_cmd {arg} {
     global verbose
     global loadpath
@@ -206,6 +211,11 @@
             verbose "\t\tLoaded $arg into the $GDB"
             send_gdb "exec-file $arg\n" 
             gdb_expect {
+	        -re "A program is being debugged already.*Kill it.*y or n. $" {
+	            send_gdb "y\n"
+	                verbose "\t\tKilling previous program being debugged"
+	            exp_continue
+	        }
                 -re ".*$gdb_prompt $" {
                     verbose "\t\tLoaded $arg with new symbol table into $GDB"
                     return 0
@@ -221,23 +231,9 @@
             perror "$arg wasn't compiled with \"-g\""
             return -1
         }
-        -re "A program is being debugged already.*Kill it.*y or n. $" {
-            send_gdb "y\n"
-                verbose "\t\tKilling previous program being debugged"
-            exp_continue
-        }
         -re "Load new symbol table from \".*\".*y or n. $" {
             send_gdb "y\n"
-            gdb_expect {
-                -re "Reading symbols from.*done.*$gdb_prompt $" {
-                    verbose "\t\tLoaded $arg with new symbol table into $GDB"
-                    return 0
-                }
-                timeout {
-                    perror "(timeout) Couldn't load $arg, other program already loaded."
-                    return -1
-                }
-            }
+	    exp_continue
         }
         -re ".*No such file or directory.*$gdb_prompt $" {
             perror "($arg) No such file or directory\n"
@@ -339,4 +335,6 @@
 gdb_exit
 
 set GDBFLAGS $saved_gdbflags
+eval proc gdb_file_cmd {$old_gdb_file_cmd_args} {$old_gdb_file_cmd_body}
+
 return 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]