aboutsummaryrefslogtreecommitdiff
path: root/gdb/ch-valprint.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1993-04-07 22:15:48 +0000
committerPer Bothner <per@bothner.com>1993-04-07 22:15:48 +0000
commit8a177da6582bc176c0dd3b58583c8096674ea853 (patch)
treefd3dcf916ad17d96e1e1ef19f817df1af9c8737d /gdb/ch-valprint.c
parentbee218aaac30e76d6a530d6656ff576cd1f2a618 (diff)
downloadfsf-binutils-gdb-8a177da6582bc176c0dd3b58583c8096674ea853.zip
fsf-binutils-gdb-8a177da6582bc176c0dd3b58583c8096674ea853.tar.gz
fsf-binutils-gdb-8a177da6582bc176c0dd3b58583c8096674ea853.tar.bz2
* ch-exp.y: Remove ambiguities. Fix or add support for
UNOP_IND, UNOP_CAST, UNOP_ADDR, STRUCOP_STRUCT, OP_TYPE. * ch-typeprint.c (chill_print_type): Move support for TYPE_CODE_ARRAY and TYPE_CODE_STRING from here ... * ch-typeprint.c (chill_type_print_base): ... here. * ch-typeprint.c (chill_type_print_base): Improve support for PTR, REF, and FUNC types. * ch-valprint.c: Prefer H'%x format to 0x%s. * ch-valprint.c (chill_val_print): Add support for printing TYPE_CODE_REF (return for LOC parameters and variables). Use c_val_print to print random types (including ENUM). * ch-valprint,c (chill_print_value_fields): Make output look more like Chill tuples. * stabsread.c (read_struct_type): Factor common code.
Diffstat (limited to 'gdb/ch-valprint.c')
-rw-r--r--gdb/ch-valprint.c55
1 files changed, 43 insertions, 12 deletions
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index c0ec4f7..e779758 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -157,7 +157,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
}
if (addressprint && format != 's')
{
- fprintf_filtered (stream, "0x%x", addr);
+ fprintf_filtered (stream, "H'%x", addr);
}
/* For a pointer to char or unsigned char, also print the string
@@ -185,7 +185,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
}
if (addressprint && format != 's')
{
- fprintf_filtered (stream, "0x%x ", addr);
+ fprintf_filtered (stream, "H'%x ", addr);
}
i = TYPE_LENGTH (type);
LA_PRINT_STRING (stream, valaddr, i, 0);
@@ -199,20 +199,50 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
0);
break;
- case TYPE_CODE_MEMBER:
case TYPE_CODE_REF:
- case TYPE_CODE_UNION:
+ if (addressprint)
+ {
+ fprintf_filtered (stream, "LOC(H'%lx)",
+ unpack_long (builtin_type_int, valaddr));
+ if (deref_ref)
+ fputs_filtered (": ", stream);
+ }
+ /* De-reference the reference. */
+ if (deref_ref)
+ {
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
+ {
+ value deref_val =
+ value_at
+ (TYPE_TARGET_TYPE (type),
+ unpack_pointer (lookup_pointer_type (builtin_type_void),
+ valaddr));
+ val_print (VALUE_TYPE (deref_val),
+ VALUE_CONTENTS (deref_val),
+ VALUE_ADDRESS (deref_val), stream, format,
+ deref_ref, recurse + 1, pretty);
+ }
+ else
+ fputs_filtered ("???", stream);
+ }
+ break;
+
case TYPE_CODE_ENUM:
+ c_val_print (type, valaddr, address, stream, format,
+ deref_ref, recurse, pretty);
+ break;
+
+ case TYPE_CODE_MEMBER:
+ case TYPE_CODE_UNION:
case TYPE_CODE_FUNC:
case TYPE_CODE_VOID:
case TYPE_CODE_ERROR:
case TYPE_CODE_RANGE:
- error ("Unimplemented chill_val_print support for type %d",
- TYPE_CODE (type));
- break;
-
default:
- error ("Invalid Chill type code %d in symbol table.", TYPE_CODE (type));
+ /* Let's derfer printing to the C printer, rather than
+ print an error message. FIXME! */
+ c_val_print (type, valaddr, address, stream, format,
+ deref_ref, recurse, pretty);
}
fflush (stream);
return (0);
@@ -243,7 +273,7 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
check_stub_type (type);
- fprintf_filtered (stream, "(");
+ fprintf_filtered (stream, "[");
len = TYPE_NFIELDS (type);
if (len == 0)
{
@@ -267,9 +297,10 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
{
wrap_here (n_spaces (2 + 2 * recurse));
}
+ fputs_filtered (".", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
language_chill, DMGL_NO_OPTS);
- fputs_filtered (" = ", stream);
+ fputs_filtered (": ", stream);
if (TYPE_FIELD_PACKED (type, i))
{
value v;
@@ -295,6 +326,6 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty,
print_spaces_filtered (2 * recurse, stream);
}
}
- fprintf_filtered (stream, ")");
+ fprintf_filtered (stream, "]");
}