diff options
author | Per Bothner <per@bothner.com> | 1996-01-24 07:02:57 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1996-01-24 07:02:57 +0000 |
commit | c6038971d6957f1244f2224002ba961c81b7ac71 (patch) | |
tree | 9647d17c387a1d4a9151394328b021b2f8d9ff60 /gdb/c-valprint.c | |
parent | 4e327047ce195fe703b5ee64badca4631883cbe0 (diff) | |
download | gdb-c6038971d6957f1244f2224002ba961c81b7ac71.zip gdb-c6038971d6957f1244f2224002ba961c81b7ac71.tar.gz gdb-c6038971d6957f1244f2224002ba961c81b7ac71.tar.bz2 |
* stabsread.c (rs6000_builtin_type): Make bool type unsigned.
(read_one_struct_field): Support boolean bitfields.
* c-valprint.c (c_val_print): Print booleans properly.
Diffstat (limited to 'gdb/c-valprint.c')
-rw-r--r-- | gdb/c-valprint.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index f4abf7f..a16f87c 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -335,8 +335,20 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse, break; case TYPE_CODE_BOOL: - /* Do something at least vaguely reasonable, for example if the - language is set wrong. */ + format = format ? format : output_format; + if (format) + print_scalar_formatted (valaddr, type, format, 0, stream); + else + { + val = unpack_long (type, valaddr); + if (val == 0) + fputs_filtered ("false", stream); + else if (val == 1) + fputs_filtered ("true", stream); + else + print_longest (stream, 'd', 0, val); + } + break; case TYPE_CODE_RANGE: /* FIXME: create_range_type does not set the unsigned bit in a |