Re: [PATCH] Fix mi "-var-create" regression

Joel Brobecker
2013-01-03T03:46:18Z

> 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 *?

Thanks!

> 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

--
Joel