forked from Imagelibrary/binutils-gdb
gdb
PR python/13281: * gdbtypes.h (TYPE_FLAG_ENUM): New macro. (struct main_type) <flag_flag_enum>: New field. * dwarf2read.c (process_enumeration_scope): Detect "flag" enums. * NEWS: Add entries. * c-valprint.c (c_val_print) <TYPE_CODE_ENUM>: Handle "flag" enums. * python/lib/gdb/printing.py (_EnumInstance): New class. (FlagEnumerationPrinter): Likewise. gdb/doc * gdb.texinfo (gdb.printing): Document FlagEnumerationPrinter. gdb/testsuite * gdb.base/printcmds.c (enum flag_enum): New. (three): New global. * gdb.base/printcmds.exp (test_print_enums): Add test for flag enum printing. * gdb.python/py-pp-maint.py (build_pretty_printer): Instantiate FlagEnumerationPrinter. * gdb.python/py-pp-maint.exp: Add tests for FlagEnumerationPrinter. * gdb.python/py-pp-maint.c (enum flag_enum): New. (fval): New global.
This commit is contained in:
@@ -290,6 +290,12 @@ enum type_instance_flag_value
|
||||
|
||||
#define TYPE_DECLARED_CLASS(t) (TYPE_MAIN_TYPE (t)->flag_declared_class)
|
||||
|
||||
/* True if this type is a "flag" enum. A flag enum is one where all
|
||||
the values are pairwise disjoint when "and"ed together. This
|
||||
affects how enum values are printed. */
|
||||
|
||||
#define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum)
|
||||
|
||||
/* Constant type. If this is set, the corresponding type has a
|
||||
const modifier. */
|
||||
|
||||
@@ -400,6 +406,11 @@ struct main_type
|
||||
"struct". */
|
||||
unsigned int flag_declared_class : 1;
|
||||
|
||||
/* True if this is an enum type with disjoint values. This affects
|
||||
how the enum is printed. */
|
||||
|
||||
unsigned int flag_flag_enum : 1;
|
||||
|
||||
/* A discriminant telling us which field of the type_specific union
|
||||
is being used for this type, if any. */
|
||||
ENUM_BITFIELD(type_specific_kind) type_specific_field : 3;
|
||||
|
||||
Reference in New Issue
Block a user