aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/printcmd.c2
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.cp/ref-types.exp5
4 files changed, 18 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4aa6df4..972a64d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-04 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ PR exp/11349.
+ * printcmd.c (x_command): Only dereference once implicitly for
+ TYPE_CODE_REF.
+
2010-05-03 Doug Evans <dje@google.com>
* event-loop.c (gdb_timer): Delete unused global.
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 735b043..16ea2a6 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1420,7 +1420,7 @@ x_command (char *exp, int from_tty)
old_chain = make_cleanup (free_current_contents, &expr);
val = evaluate_expression (expr);
if (TYPE_CODE (value_type (val)) == TYPE_CODE_REF)
- val = value_ind (val);
+ val = coerce_ref (val);
/* In rvalue contexts, such as this, functions are coerced into
pointers to functions. This makes "x/i main" work. */
if (/* last_format == 'i' && */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1918726..f8aaf35 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-04 Pierre Muller <muller@ics.u-strasbg.fr>
+
+ PR exp/11349.
+ * testsuite/gdb.cp/ref-types.exp: Add test to examine
+ use a reference local variable.
+
2010-05-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/break-interp.exp: Remove $exec.debug safety removal.
diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp
index 1308433..977eaa4 100644
--- a/gdb/testsuite/gdb.cp/ref-types.exp
+++ b/gdb/testsuite/gdb.cp/ref-types.exp
@@ -200,6 +200,11 @@ gdb_expect {
timeout { fail "(timeout) print value of *rps" }
}
+# GDB had a bug about dereferencing a pointer type
+# that would lead to wrong results
+# if we try to examine memory at pointer value.
+
+gdb_test "x /hd rps" "$hex:\[ \t\]*-1" "examine value at rps"
send_gdb "ptype rps\n"
gdb_expect {