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]

[PATCH] testsuite: Fix mi-var-display.exp crashing


Hi,

 This change fixes a test case crash where the frame pointer couldn't 
have been previously obtained:

(gdb)
FAIL: gdb.mi/mi-var-display.exp: get children of anone
p/x $fp
&"p/x $fp\n"
&"No registers.\n"
^error,msg="No registers."
(gdb)
FAIL: gdb.mi/mi-var-display.exp: print FP register (timeout)
[...]
(gdb)
FAIL: gdb.mi/mi-var-display.exp: create local variable a1
ERROR: tcl error sourcing .../gdb/testsuite/gdb.mi/mi-var-display.exp.
ERROR: can't read "fp": no such variable
    while executing
"mi_gdb_test "-var-create a2 $fp a" \
        "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
        "create variable a2 in different scope""
    (file ".../gdb/testsuite/gdb.mi/mi-var-display.exp" line 617)
    invoked from within
"source .../gdb/testsuite/gdb.mi/mi-var-display.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.mi/mi-var-display.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
testcase .../gdb/testsuite/gdb.mi/mi-var-display.exp completed in 43 seconds

Of course any original issue causing the frame pointer access to fail 
should be fixed in the first place, but in any case the script shouldn't 
crash.

 As we cannot make a meaningful test with no valid value of the frame 
pointer available let's just mark this case untested (as it indeed is).  
With the change in place I now get:

(gdb)
FAIL: gdb.mi/mi-var-display.exp: get children of anone
p/x $fp
&"p/x $fp\n"
&"No registers.\n"
^error,msg="No registers."
(gdb)
FAIL: gdb.mi/mi-var-display.exp: print FP register (timeout)
(gdb)
FAIL: gdb.mi/mi-var-display.exp: create local variable a1
UNTESTED: gdb.mi/mi-var-display.exp: create variable a2 in different scope
testcase .../gdb/testsuite/gdb.mi/mi-var-display.exp completed in 44 seconds

 I have verified the update causes no changes in successful runs of this 
test case.

 OK to apply?

2012-05-05  Maciej W. Rozycki  <macro@codesourcery.com>

	gdb/testsuite/
	* gdb.mi/mi-var-display.exp: Check for the existence of $fp
	before using it.

  Maciej

gdb-test-mi-var-display-fp.diff
Index: gdb-fsf-trunk-quilt/gdb/testsuite/gdb.mi/mi-var-display.exp
===================================================================
--- gdb-fsf-trunk-quilt.orig/gdb/testsuite/gdb.mi/mi-var-display.exp	2012-02-24 15:23:16.000000000 +0000
+++ gdb-fsf-trunk-quilt/gdb/testsuite/gdb.mi/mi-var-display.exp	2012-05-05 23:13:18.625636078 +0100
@@ -614,9 +614,13 @@ mi_gdb_test "-var-create a1 * a" \
 	"\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
 	"create local variable a1"
 
-mi_gdb_test "-var-create a2 $fp a" \
+if { [info exists fp] } {
+    mi_gdb_test "-var-create a2 $fp a" \
 	"\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
 	"create variable a2 in different scope"
+} else {
+    untested "create variable a2 in different scope"
+}
 
 #gdbtk_test c_variable-7.81 {create variables in different scopes} {
 #  set a1 [gdb_variable create -expr a]


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