This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFC: fix PR 7643
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 25 Jan 2010 12:57:33 -0700
- Subject: RFC: fix PR 7643
- Reply-to: tromey at redhat dot com
This fixes PR exp/7643.
The bug is:
(gdb) ptype &*"foo"
type = char [4]
... where the correct answer is "char *".
The fix is to add a call coerce_array in the optimized UNOP_IND case in
evaluate_subexp_for_address.
I plan to check this in, but before doing so I thought I would ask to
see whether this messes anything up for non-C languages (specifically
Ada, I suppose).
I built and regtested this on x86-64 (compile farm). So, if this is in
fact wrong for some other language, a test case would be handy.
Tom
2010-01-25 Tom Tromey <tromey@redhat.com>
PR exp/7643:
* eval.c (evaluate_subexp_for_address) <UNOP_IND>: Call
coerce_array on result.
2010-01-25 Tom Tromey <tromey@redhat.com>
PR exp/7643:
* gdb.base/printcmds.exp (test_print_string_constants): Remove
setup_kfail.
Index: eval.c
===================================================================
RCS file: /cvs/src/src/gdb/eval.c,v
retrieving revision 1.125
diff -u -r1.125 eval.c
--- eval.c 18 Jan 2010 20:54:33 -0000 1.125
+++ eval.c 25 Jan 2010 19:53:35 -0000
@@ -2629,7 +2629,7 @@
goto default_case_after_eval;
}
- return x;
+ return coerce_array (x);
case UNOP_MEMVAL:
(*pos) += 3;
Index: testsuite/gdb.base/printcmds.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/printcmds.exp,v
retrieving revision 1.28
diff -u -r1.28 printcmds.exp
--- testsuite/gdb.base/printcmds.exp 25 Jan 2010 19:31:24 -0000 1.28
+++ testsuite/gdb.base/printcmds.exp 25 Jan 2010 19:53:37 -0000
@@ -647,7 +647,6 @@
gdb_test "p *\"foo\"" " = 102 'f'"
gdb_test "ptype *\"foo\"" " = char"
gdb_test "p &*\"foo\"" " = \"foo\""
- setup_kfail "gdb/538" *-*-*
gdb_test "ptype &*\"foo\"" "type = char \\*"
gdb_test "p (char *)\"foo\"" " = \"foo\""
}