aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-valprint.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-01-01 11:39:07 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-01-01 11:39:07 +0000
commit969a136098c462168631b0f20bbe5e1fcb8176bb (patch)
tree318fdae7f55dd23c467d1eb36babd1e2cb5585ed /gdb/ada-valprint.c
parentb7789565fa3afa8b4da2b2c26ac5670f5a95e2dd (diff)
downloadgdb-969a136098c462168631b0f20bbe5e1fcb8176bb.zip
gdb-969a136098c462168631b0f20bbe5e1fcb8176bb.tar.gz
gdb-969a136098c462168631b0f20bbe5e1fcb8176bb.tar.bz2
* ada-valprint.c (ada_val_print_1) [TYPE_CODE_REF]: Ignore deref_ref
and always print the dereferenced value.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r--gdb/ada-valprint.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index b96baf0..d2def87 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -855,32 +855,35 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
return len;
case TYPE_CODE_REF:
+ /* For references, the debugger is expected to print the value as
+ an address if DEREF_REF is null. But printing an address in place
+ of the object value would be confusing to an Ada programmer.
+ So, for Ada values, we print the actual dereferenced value
+ regardless. */
elttype = check_typedef (TYPE_TARGET_TYPE (type));
- /* De-reference the reference */
- if (deref_ref)
- {
- if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
- {
- LONGEST deref_val_int = (LONGEST)
- unpack_pointer (lookup_pointer_type (builtin_type_void),
- valaddr);
- if (deref_val_int != 0)
- {
- struct value *deref_val =
- ada_value_ind (value_from_longest
- (lookup_pointer_type (elttype),
- deref_val_int));
- val_print (value_type (deref_val),
- value_contents (deref_val), 0,
- VALUE_ADDRESS (deref_val), stream, format,
- deref_ref, recurse + 1, pretty);
- }
- else
- fputs_filtered ("(null)", stream);
- }
- else
- fputs_filtered ("???", stream);
- }
+
+ if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
+ {
+ LONGEST deref_val_int = (LONGEST)
+ unpack_pointer (lookup_pointer_type (builtin_type_void),
+ valaddr);
+ if (deref_val_int != 0)
+ {
+ struct value *deref_val =
+ ada_value_ind (value_from_longest
+ (lookup_pointer_type (elttype),
+ deref_val_int));
+ val_print (value_type (deref_val),
+ value_contents (deref_val), 0,
+ VALUE_ADDRESS (deref_val), stream, format,
+ deref_ref, recurse + 1, pretty);
+ }
+ else
+ fputs_filtered ("(null)", stream);
+ }
+ else
+ fputs_filtered ("???", stream);
+
break;
}
gdb_flush (stream);