This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix mi "-var-create" regression
- From: Luis Machado <lgustavo at codesourcery dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Andreas Schwab <schwab at linux-m68k dot org>, Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org
- Date: Thu, 03 Jan 2013 10:30:28 -0200
- Subject: Re: [PATCH] Fix mi "-var-create" regression
- References: <20121014171805.GB3050@adacore.com> <507BFF97.2000900@codesourcery.com> <87y5j4ziof.fsf@fleche.redhat.com> <508DB53E.30507@codesourcery.com> <m2y5hkqiet.fsf@igel.home> <20121129210737.GM3581@adacore.com> <50B81642.9020705@codesourcery.com> <20121207024813.GD31477@adacore.com> <50C159A3.4020507@codesourcery.com> <50DAEE08.8010200@codesourcery.com> <20130103034602.GA3863@adacore.com>
- Reply-to: lgustavo at codesourcery dot com
On 01/03/2013 01:46 AM, Joel Brobecker wrote:
This patch addresses the problem Andreas saw by creating a variable
of type (void *). This way we are guaranteed to have the type we
need to reproduce the problem.
I don't see a problem with that. But can you add a comment explaining
why you are casting the register to void *?
Yes, of course.
How does this comment look?
Luis
diff --git a/ChangeLog b/ChangeLog
index a5a47ca..aa180a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-03 Luis Machado <lgustavo@codesourcery.com>
+
+ * gdb.mi/mi-var-create-rtti.exp: Create a variable of
+ type void *.
+
2012-12-20 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* Makefile.def (install-target-libgo): Depend on
diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
index da3cf1b..f991951 100644
--- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
@@ -45,8 +45,10 @@ if ![mi_run_to_main] {
# Enable "print object"
mi_gdb_test "-gdb-set print object on" ".*"
-# Test creating a variable for $sp
-mi_gdb_test "-var-create sp1 * \$sp" \
+# Test creating a variable for $sp.
+# We use a explicit cast to (void *) as that is the
+# type that caused the bug this testcase is testing for.
+mi_gdb_test "-var-create sp1 * ((void*)\$sp)" \
"\\^done,name=\"sp1\",numchild=\"0\",value=\"$hex\",type=\"void \\*\",has_more=\"0\"" \
"-var-create sp1 * \$sp"
gdb_exit