This is the mail archive of the gdb-patches@sourceware.org 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]

[RFC] Add another "Are you sure..." case to gdb_unload in lib/gdb.exp


During my recent testing of a mep-elf toolchain, I ran across a problem
in gdb.base/opaque.exp (and perhaps some other tests too) in which
GDB asks "Are you sure you want to change the file?" The test
machinery is not expecting this message from GDB and ends up getting
hopelessly confused.

Here's a bit of the log file from gdb.base/opaque.exp which demonstrates
this confusion:

(gdb) PASS: gdb.base/opaque.exp: ptype on opaque struct tagname (statically)
dir
Reinitialize source path to empty? (y or n) y
Source directories searched: $cdir:$cwd
(gdb) dir /ironwood1/toshmep-070403-branch/mep-elf/bld/../../devo/gdb/testsuite/ 
gdb.base
Source directories searched: /ironwood1/toshmep-070403-branch/mep-elf/bld/../../devo/gdb/testsuite/gdb.base:$cdir:$cwd
(gdb) file
A program is being debugged already.
Are you sure you want to change the file? (y or n) ERROR: couldn't unload file in /ironwood1/toshmep-070403-branch/mep-elf/bld/gdb/testsuite/../../gdb/gdb (timed out).
kill
Please answer y or n.
A program is being debugged already.
Are you sure you want to change the file? (y or n) file /ironwood1/toshmep-070403-branch/mep-elf/bld/gdb/testsuite/gdb.base/opaque
Please answer y or n.
A program is being debugged already.
Are you sure you want to change the file? (y or n) ERROR: couldn't load /ironwood1/toshmep-070403-branch/mep-elf/bld/gdb/testsuite/gdb.base/opaque into /ironwood1/toshmep-070403-branch/mep-elf/bld/gdb/testsuite/../../gdb/gdb (timed out).
delete breakpoints
Please answer y or n.
A program is being debugged already.
Are you sure you want to change the file? (y or n) ERROR: Delete all breakpoints in delete_breakpoints (timeout)
break main
Please answer y or n.
A program is being debugged already.
Are you sure you want to change the file? (y or n) UNRESOLVED: gdb.base/opaque.exp: setting breakpoint at main (timeout)
ERROR: cannot run to breakpoint at main
ERROR: Got interactive prompt.
UNRESOLVED: gdb.base/opaque.exp: whatis on opaque struct pointer (dynamically)
ERROR: Got interactive prompt.
...

My patch below adds a suitable case to gdb_unload in lib/gdb.exp.

Comments?


	* lib/gdb.exp (gdb_unload): Add case which checks for GDB's
	"Are you sure you want to change the file?" message.

Index: ./testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.83
diff -u -p -r1.83 gdb.exp
--- ./testsuite/lib/gdb.exp	2 Jul 2007 21:29:28 -0000	1.83
+++ ./testsuite/lib/gdb.exp	14 Jul 2007 01:11:25 -0000
@@ -133,6 +133,11 @@ proc gdb_unload {} {
 		verbose "\t\tKilling previous program being debugged"
 	    exp_continue
 	}
+	-re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
+	    { send_gdb "y\n"
+		verbose "\t\tChanging the file being debugged"
+	    exp_continue
+	}
 	-re "Discard symbol table from .*y or n.*$" {
 	    send_gdb "y\n"
 	    exp_continue


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