From 3bcf418186358df5756e645b6e6034198b3ce2b6 Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Wed, 4 Jan 1995 01:04:15 +0000 Subject: [PATCH] * ch-typeprint.c (chill_type_print_base): Get names of PTR and BOOL from TYPE_NAME. * ch-valprint.c (chill_print_type_scalar): New function, to handle TYPE_CODE_RANGE better than print_type_scalar does. (chill_val_print_array_elements): Use above new function. --- gdb/ChangeLog | 8 ++++++++ gdb/ch-typeprint.c | 6 ++++-- gdb/ch-valprint.c | 33 +++++++++++++++++++++++++++++---- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b06c33c9f7c..745e2ea17c9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +Tue Jan 3 16:52:03 1995 Per Bothner + + * ch-typeprint.c (chill_type_print_base): Get names of PTR and + BOOL from TYPE_NAME. + * ch-valprint.c (chill_print_type_scalar): New function, to handle + TYPE_CODE_RANGE better than print_type_scalar does. + (chill_val_print_array_elements): Use above new function. + Mon Jan 2 15:02:51 1995 Stan Shebs * remote-udi.c (udi_load): Tell symbol_file_add that the diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c index 41a7d6fb4ea..88d994d849d 100644 --- a/gdb/ch-typeprint.c +++ b/gdb/ch-typeprint.c @@ -106,7 +106,8 @@ chill_type_print_base (type, stream, show, level) case TYPE_CODE_PTR: if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID) { - fprintf_filtered (stream, "PTR"); + fprintf_filtered (stream, + TYPE_NAME (type) ? TYPE_NAME (type) : "PTR"); break; } fprintf_filtered (stream, "REF "); @@ -118,7 +119,8 @@ chill_type_print_base (type, stream, show, level) anyone ever fixes the compiler to give us the real names in the presence of the chill equivalent of typedef (assuming there is one). */ - fprintf_filtered (stream, "BOOL"); + fprintf_filtered (stream, + TYPE_NAME (type) ? TYPE_NAME (type) : "BOOL"); break; case TYPE_CODE_ARRAY: diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c index 11d1a22204f..91fe4596f19 100644 --- a/gdb/ch-valprint.c +++ b/gdb/ch-valprint.c @@ -35,6 +35,30 @@ static void chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int, enum val_prettyprint, struct type **)); + +/* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM. + Used to print data from type structures in a specified type. For example, + array bounds may be characters or booleans in some languages, and this + allows the ranges to be printed in their "natural" form rather than as + decimal integer values. */ + +void +chill_print_type_scalar (type, val, stream) + struct type *type; + LONGEST val; + GDB_FILE *stream; +{ + switch (TYPE_CODE (type)) + { + case TYPE_CODE_RANGE: + if (TYPE_TARGET_TYPE (type)) + { + chill_print_type_scalar (TYPE_TARGET_TYPE (type), val, stream); + return; + } + } + print_type_scalar (type, val, stream); +} /* Print the elements of an array. Similar to val_print_array_elements, but prints @@ -99,11 +123,12 @@ chill_val_print_array_elements (type, valaddr, address, stream, } fputs_filtered ("(", stream); - print_type_scalar (index_type, low_bound + i, stream); + chill_print_type_scalar (index_type, low_bound + i, stream); if (reps > 1) { fputs_filtered (":", stream); - print_type_scalar (index_type, low_bound + i + reps - 1, stream); + chill_print_type_scalar (index_type, low_bound + i + reps - 1, + stream); fputs_filtered ("): ", stream); val_print (elttype, valaddr + i * eltlen, 0, stream, format, deref_ref, recurse + 1, pretty); @@ -323,7 +348,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, { if (need_comma) fputs_filtered (", ", stream); - print_type_scalar (range, i, stream); + chill_print_type_scalar (range, i, stream); need_comma = 1; /* Look for a continuous range of true elements. */ @@ -334,7 +359,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, while (i+1 <= high_bound && value_bit_index (type, valaddr, ++i)) j = i; - print_type_scalar (range, j, stream); + chill_print_type_scalar (range, j, stream); } } } -- 2.30.2