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>
- Cc: Joel Brobecker <brobecker at adacore dot com>, Andreas Schwab <schwab at linux-m68k dot org>, Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 26 Dec 2012 10:31:04 -0200
- Subject: Re: [PATCH] Fix mi "-var-create" regression
- References: <5075D4FD.9050900@mentor.com> <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>
- Reply-to: lgustavo at codesourcery dot com
Hi,
On 12/07/2012 12:51 AM, Luis Machado wrote:
On 12/07/2012 12:48 AM, Joel Brobecker wrote:
And do you absolutely need the register to be of type (void *)
for the test to exercise the original problem? I don't know if
we can find any that's guaranteed to be of any type. So you might
have to use different register names depending on the target.
Yeah. I may need to do something different here. I didn't forget about
this one though.
Luis
Casting seems to be the most sensible solution to this problem.
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 thought about replacing SP with PC, but SP is probably available for
all targets.
What do you think?
Luis
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4620c2e..9ffd991 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-26 Luis Machado <lgustavo@codesourcery.com>
+
+ * gdb.mi/mi-var-create-rtti.exp: Create a variable of
+ type void *.
+
2012-12-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.mi/mi-fullname-deleted.exp: New file.
diff --git a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
index 16d8551..d6697de 100644
--- a/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-create-rtti.exp
@@ -46,7 +46,7 @@ if ![mi_run_to_main] {
mi_gdb_test "-gdb-set print object on" ".*"
# Test creating a variable for $sp
-mi_gdb_test "-var-create sp1 * \$sp" \
+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