mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
Based on a previous patch form Michal Ludvig:
* gdbtypes.c (append_flags_type_flag, init_flags_type): New functions. (is_integral_type, rank_one_type, recursive_dump_type): Add support for TYPE_CODE_FLAGS. * gdbtypes.h (enum type_code): Add TYPE_CODE_FLAGS. (append_flags_type_field, init_flags_type): New prototypes. * ada-valprint.c (ada_val_print_1): Add support for TYPE_CODE_FLAGS. * c-valprint.c (c_val_print): Likewise. * f-valprint.c (f_val_print): Likewise. * p-valprint.c (pascal_val_print): Likewise. * valprint.c (val_print_type_code_flags): New function. * valprint.h (val_print_type_code_flags): New prototype. * value.c (unpack_long, value_from_longest): Add support for TYPE_CODE_FLAGS.
This commit is contained in:
@@ -326,6 +326,27 @@ val_print_type_code_int (struct type *type, const gdb_byte *valaddr,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
|
||||
struct ui_file *stream)
|
||||
{
|
||||
LONGEST val = unpack_long (type, valaddr);
|
||||
int bitpos, nfields = TYPE_NFIELDS (type);
|
||||
|
||||
fputs_filtered ("[ ", stream);
|
||||
for (bitpos = 0; bitpos < nfields; bitpos++)
|
||||
{
|
||||
if (TYPE_FIELD_BITPOS (type, bitpos) != -1 && (val & (1 << bitpos)))
|
||||
{
|
||||
if (TYPE_FIELD_NAME (type, bitpos))
|
||||
fprintf_filtered (stream, "%s ", TYPE_FIELD_NAME (type, bitpos));
|
||||
else
|
||||
fprintf_filtered (stream, "#%d ", bitpos);
|
||||
}
|
||||
}
|
||||
fputs_filtered ("]", stream);
|
||||
}
|
||||
|
||||
/* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
|
||||
The raison d'etre of this function is to consolidate printing of
|
||||
LONG_LONG's into this one function. The format chars b,h,w,g are
|
||||
|
||||
Reference in New Issue
Block a user