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]

[obv] testsuite: Fix fuzzy results: mi-var-cmd.exp and mi2-var-cmd.exp


Hi,

 -var-update *
-^done,changelist=[{name="func",in_scope="true",type_changed="false",has_more="0"},{name="lpsimple",in_scope="true",type_changed="false",has_more="0"}]
+^done,changelist=[{name="func",in_scope="true",type_changed="false",has_more="0"}]
 (gdb) 
-PASS: gdb.mi/mi-var-cmd.exp: update all vars: func and lpsimple changed
+FAIL: gdb.mi/mi-var-cmd.exp: update all vars: func and lpsimple changed
&&
-PASS: gdb.mi/mi2-var-cmd.exp: update all vars: func and lpsimple changed
+FAIL: gdb.mi/mi2-var-cmd.exp: update all vars: func and lpsimple changed

Happenning on i686-fedorarawhide-linux-gnu but not on
{x86_64,x86_64-m32}-fedorarawhide-linux-gnu (I think it could happen also on
x86_64-m32 but I may had a bad luck).

How an uninitialized variable could have the exact value?  Apparently it can,
before initialization the value is very similar to the value later set.
	-var-evaluate-expression lpsimple
	^done,value="0xffffcb00"
and after:
	lpsimple = &lsimple;
it is:
	-var-evaluate-expression lpsimple
	^done,value="0xffffcb30"

So I can imagine in some cases it may match exactly.  Hopefully this patch
removes this fuzziness.

No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu.

Checked in.


Thanks,
Jan

http://sourceware.org/ml/gdb-cvs/2012-01/msg00201.html

--- src/gdb/testsuite/ChangeLog	2012/01/24 15:13:29	1.3035
+++ src/gdb/testsuite/ChangeLog	2012/01/24 20:35:35	1.3036
@@ -1,3 +1,9 @@
+2012-01-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix fuzzy results.
+	* gdb.mi/var-cmd.c (do_locals_tests): Initialize variables lsimple,
+	lpsimple and func.
+
 2012-01-24  Gary Benson  <gbenson@redhat.com>
 
 	Delete #if 0'd out code.
--- src/gdb/testsuite/gdb.mi/var-cmd.c	2012/01/12 22:50:49	1.26
+++ src/gdb/testsuite/gdb.mi/var-cmd.c	2012/01/24 20:35:35	1.27
@@ -140,9 +140,9 @@
   float *lpfloat = 0;
   double ldouble = 0;
   double *lpdouble = 0;
-  struct _simple_struct lsimple;
-  struct _simple_struct *lpsimple;
-  void (*func) (void);
+  struct _simple_struct lsimple = { 0 };
+  struct _simple_struct *lpsimple = 0;
+  void (*func) (void) = 0;
 
   /* Simple assignments */
   linteger = 1234;


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