diff options
author | Per Bothner <per@bothner.com> | 1993-12-21 22:18:51 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1993-12-21 22:18:51 +0000 |
commit | cba009211a9e13e8c773c30fb35dd8ef61477554 (patch) | |
tree | e42b77103ff82669f7367b7e5b7c2b76de10d6ed /gdb/ch-valprint.c | |
parent | 0c3cab7aacb7e60306be0e798824803dca8d08d9 (diff) | |
download | gdb-cba009211a9e13e8c773c30fb35dd8ef61477554.zip gdb-cba009211a9e13e8c773c30fb35dd8ef61477554.tar.gz gdb-cba009211a9e13e8c773c30fb35dd8ef61477554.tar.bz2 |
* ch-exp.y (match_dollar_tokens): Fix off-by-one bug.
* ch-lang.c (chill_is_varying_struct), ch-lang.h: New function.
* ch-lang.c (chill_printstr): Use double quotes, not single quotes.
* ch-typeprint.c (chill_type_print_base): Handle TYPE_CODE_BITSTRING.
Improve printing of TYPE_CODE_STRING, TYPE_CODE_SET, and
TYPE_CODE_STRUCT (including checking chill_is_varying_struct).
Print TYPE_DUMMY_RANGE by printing its TYPE_TARGET_TYPE.
Handle TYPE_CODE_ENUM.
* ch-valprint.c (chill_val_print): Handle TYPE_CODE_BITSTRING.
For TYPE_CODE_STRING, never print address. Handle VARYING strings.
* gdbtypes.c (force_to_range_type): New.
* gdbtypes.c (create_set_type): Make work, following Chill layout.
* gdbtypes.h (TYPE_LOW_BOUND, TYPE_HIGH_BOUND, TYPE_DUMMY_RANGE): New.
* stabsread.c (read_type): Distinguish string and bitstring from
char-array and set.
* valarith.c (value_subscript), valops.c (value_coerce_array):
Handle STRINGs as well as ARRAYs.
* valarith.c (value_bit_index): Fix think. Use new macros.
Diffstat (limited to 'gdb/ch-valprint.c')
-rw-r--r-- | gdb/ch-valprint.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c index 1f0987c..e1e5929 100644 --- a/gdb/ch-valprint.c +++ b/gdb/ch-valprint.c @@ -183,12 +183,6 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, print_scalar_formatted (valaddr, type, format, 0, stream); break; } - if (addressprint && format != 's') - { - /* This used to say `addr', which is unset at this point. - Is `address' what is meant? */ - fprintf_filtered (stream, "H'%lx ", (unsigned long) address); - } i = TYPE_LENGTH (type); LA_PRINT_STRING (stream, valaddr, i, 0); /* Return number of characters printed, plus one for the terminating @@ -196,13 +190,14 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, return (i + (print_max && i != print_max)); break; + case TYPE_CODE_BITSTRING: case TYPE_CODE_SET: { struct type *range = TYPE_FIELD_TYPE (type, 0); - int low_bound = TYPE_FIELD_BITPOS (range, 0); - int high_bound = TYPE_FIELD_BITPOS (range, 1); + int low_bound = TYPE_LOW_BOUND (range); + int high_bound = TYPE_HIGH_BOUND (range); int i; - int is_bitstring = 0; + int is_bitstring = TYPE_CODE (type) == TYPE_CODE_BITSTRING; int need_comma = 0; int in_range = 0; @@ -242,6 +237,26 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, break; case TYPE_CODE_STRUCT: + if (chill_is_varying_struct (type)) + { + struct type *inner = TYPE_FIELD_TYPE (type, 1); + long length = unpack_long (TYPE_FIELD_TYPE (type, 0), valaddr); + char *data_addr = valaddr + TYPE_FIELD_BITPOS (type, 1) / 8; + + switch (TYPE_CODE (inner)) + { + case TYPE_CODE_STRING: + if (length > TYPE_LENGTH (type)) + { + fprintf_filtered (stream, + "<dynamic length %d > static length %d>", + length, TYPE_LENGTH (type)); + length > TYPE_LENGTH (type); + } + LA_PRINT_STRING (stream, data_addr, length, 0); + return length; + } + } chill_print_value_fields (type, valaddr, stream, format, recurse, pretty, 0); break; |