diff options
author | Fred Fish <fnf@specifix.com> | 1993-02-24 15:49:47 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1993-02-24 15:49:47 +0000 |
commit | 8fbdca53aaf4d6d794f66496171d4b9aea8272d4 (patch) | |
tree | 761ccb19c3760899409912a82332e028fd6abd60 /gdb | |
parent | 0cca30f32ad8731612637e7885650726382f4561 (diff) | |
download | gdb-8fbdca53aaf4d6d794f66496171d4b9aea8272d4.zip gdb-8fbdca53aaf4d6d794f66496171d4b9aea8272d4.tar.gz gdb-8fbdca53aaf4d6d794f66496171d4b9aea8272d4.tar.bz2 |
**** start-sanitize-chill ****
* ch-typeprint.c (chill_print_type_base): Name changed to
chill_type_print_base to match pattern for C and C++ names.
* ch-typeprint.c (chill_print_type): Change "char" to "CHAR"
to be consistent with other usages.
* ch-typeprint.c (chill_type_print_base): Add support for
printing Chill STRUCT types.
* ch-valprint.c: Include values.h.
* ch-valprint.c (chill_print_value_fields): New function and
prototype for printing Chill STRUCT values.
* ch-valprint.c (chill_val_print): Fix call to val_print_string
that was being called with two args instead of three.
* ch-valprint.c (chill_val_print): Call chill_print_value_fields
to print Chill STRUCT values.
**** end-sanitize-chill ****
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 18 | ||||
-rw-r--r-- | gdb/ch-typeprint.c | 71 | ||||
-rw-r--r-- | gdb/ch-valprint.c | 93 |
3 files changed, 170 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3109458..a6e209b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +Wed Feb 24 07:41:15 1993 Fred Fish (fnf@cygnus.com) + + **** start-sanitize-chill **** + * ch-typeprint.c (chill_print_type_base): Name changed to + chill_type_print_base to match pattern for C and C++ names. + * ch-typeprint.c (chill_print_type): Change "char" to "CHAR" + to be consistent with other usages. + * ch-typeprint.c (chill_type_print_base): Add support for + printing Chill STRUCT types. + * ch-valprint.c: Include values.h. + * ch-valprint.c (chill_print_value_fields): New function and + prototype for printing Chill STRUCT values. + * ch-valprint.c (chill_val_print): Fix call to val_print_string + that was being called with two args instead of three. + * ch-valprint.c (chill_val_print): Call chill_print_value_fields + to print Chill STRUCT values. + **** end-sanitize-chill **** + Tue Feb 23 18:58:11 1993 Mike Werner (mtw@poseidon.cygnus.com) * configure.in: added testsuite to configdirs. diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c index f4119ca..e016baf 100644 --- a/gdb/ch-typeprint.c +++ b/gdb/ch-typeprint.c @@ -35,8 +35,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> #include <errno.h> -void -chill_print_type_base PARAMS ((struct type *, FILE *, int, int)); +static void +chill_type_print_base PARAMS ((struct type *, FILE *, int, int)); void chill_print_type (type, varstring, stream, show, level) @@ -75,13 +75,13 @@ chill_print_type (type, varstring, stream, show, level) range_type = TYPE_FIELD_TYPE (type, 0); index_type = TYPE_TARGET_TYPE (range_type); high_bound = TYPE_FIELD_BITPOS (range_type, 1); - fputs_filtered ("char (", stream); + fputs_filtered ("CHAR (", stream); print_type_scalar (index_type, high_bound + 1, stream); - fputs_filtered (") ", stream); + fputs_filtered (")", stream); break; default: - chill_print_type_base (type, stream, show, level); + chill_type_print_base (type, stream, show, level); break; } } @@ -98,13 +98,17 @@ chill_print_type (type, varstring, stream, show, level) LEVEL is the depth to indent by. We increase it for some recursive calls. */ -void -chill_print_type_base (type, stream, show, level) +static void +chill_type_print_base (type, stream, show, level) struct type *type; FILE *stream; int show; int level; { + char *name; + register int len; + register int i; + QUIT; wrap_here (" "); @@ -130,7 +134,55 @@ chill_print_type_base (type, stream, show, level) case TYPE_CODE_MEMBER: case TYPE_CODE_REF: case TYPE_CODE_FUNC: - chill_print_type_base (TYPE_TARGET_TYPE (type), stream, show, level); + chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level); + break; + + case TYPE_CODE_STRUCT: + fprintf_filtered (stream, "STRUCT "); + if ((name = type_name_no_tag (type)) != NULL) + { + fputs_filtered (name, stream); + fputs_filtered (" ", stream); + wrap_here (" "); + } + if (show < 0) + { + fprintf_filtered (stream, "(...)"); + } + else + { + check_stub_type (type); + fprintf_filtered (stream, "(\n"); + if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0)) + { + if (TYPE_FLAGS (type) & TYPE_FLAG_STUB) + { + fprintfi_filtered (level + 4, stream, "<incomplete type>\n"); + } + else + { + fprintfi_filtered (level + 4, stream, "<no data fields>\n"); + } + } + else + { + len = TYPE_NFIELDS (type); + for (i = TYPE_N_BASECLASSES (type); i < len; i++) + { + QUIT; + print_spaces_filtered (level + 4, stream); + chill_print_type (TYPE_FIELD_TYPE (type, i), + TYPE_FIELD_NAME (type, i), + stream, show - 1, level + 4); + if (i < (len - 1)) + { + fputs_filtered (",", stream); + } + fputs_filtered ("\n", stream); + } + } + fprintfi_filtered (level, stream, ")"); + } break; case TYPE_CODE_VOID: @@ -139,9 +191,8 @@ chill_print_type_base (type, stream, show, level) case TYPE_CODE_RANGE: case TYPE_CODE_ENUM: case TYPE_CODE_UNION: - case TYPE_CODE_STRUCT: case TYPE_CODE_METHOD: - error ("missing language support in chill_print_type_base"); + error ("missing language support in chill_type_print_base"); break; default: diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c index 37730b4..40d1553 100644 --- a/gdb/ch-valprint.c +++ b/gdb/ch-valprint.c @@ -23,8 +23,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "gdbtypes.h" #include "valprint.h" #include "expression.h" +#include "value.h" #include "language.h" +static void +chill_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int, + enum val_prettyprint, struct type **)); + /* Print data of type TYPE located at VALADDR (within GDB), which came from the inferior at address ADDRESS, onto stdio stream STREAM according to @@ -164,7 +169,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, In that case don't try to print the string. */ print_max < UINT_MAX) { - i = val_print_string (addr, stream); + i = val_print_string (addr, 0, stream); } /* Return number of characters printed, plus one for the terminating null if we have "reached the end". */ @@ -188,10 +193,14 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, return (i + (print_max && i != print_max)); break; + case TYPE_CODE_STRUCT: + chill_print_value_fields (type, valaddr, stream, format, recurse, pretty, + 0); + break; + case TYPE_CODE_MEMBER: case TYPE_CODE_REF: case TYPE_CODE_UNION: - case TYPE_CODE_STRUCT: case TYPE_CODE_ENUM: case TYPE_CODE_FUNC: case TYPE_CODE_VOID: @@ -207,3 +216,83 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse, fflush (stream); return (0); } + +/* Mutually recursive subroutines of cplus_print_value and c_val_print to + print out a structure's fields: cp_print_value_fields and cplus_print_value. + + TYPE, VALADDR, STREAM, RECURSE, and PRETTY have the + same meanings as in cplus_print_value and c_val_print. + + DONT_PRINT is an array of baseclass types that we + should not print, or zero if called from top level. */ + +static void +chill_print_value_fields (type, valaddr, stream, format, recurse, pretty, + dont_print) + struct type *type; + char *valaddr; + FILE *stream; + int format; + int recurse; + enum val_prettyprint pretty; + struct type **dont_print; +{ + int i, len; + int fields_seen = 0; + + check_stub_type (type); + + fprintf_filtered (stream, "("); + len = TYPE_NFIELDS (type); + if (len == 0) + { + fprintf_filtered (stream, "<No data fields>"); + } + else + { + for (i = 0; i < len; i++) + { + if (fields_seen) + { + fprintf_filtered (stream, ", "); + } + fields_seen = 1; + if (pretty) + { + fprintf_filtered (stream, "\n"); + print_spaces_filtered (2 + 2 * recurse, stream); + } + else + { + wrap_here (n_spaces (2 + 2 * recurse)); + } + fprint_symbol (stream, TYPE_FIELD_NAME (type, i)); + fputs_filtered (" = ", stream); + if (TYPE_FIELD_PACKED (type, i)) + { + value v; + + /* Bitfields require special handling, especially due to byte + order problems. */ + v = value_from_longest (TYPE_FIELD_TYPE (type, i), + unpack_field_as_long (type, valaddr, i)); + + chill_val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, + stream, format, 0, recurse + 1, pretty); + } + else + { + chill_val_print (TYPE_FIELD_TYPE (type, i), + valaddr + TYPE_FIELD_BITPOS (type, i) / 8, + 0, stream, format, 0, recurse + 1, pretty); + } + } + if (pretty) + { + fprintf_filtered (stream, "\n"); + print_spaces_filtered (2 * recurse, stream); + } + } + fprintf_filtered (stream, ")"); +} + |