diff options
author | Tom Tromey <tromey@redhat.com> | 2012-01-16 19:44:11 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-01-16 19:44:11 +0000 |
commit | eb28de4a09f016d3de7caccec781eb70995a4001 (patch) | |
tree | 4cfd7ffc8be8bfa5d40c1650ec47318cc7ed092e /gdb/gdbtypes.h | |
parent | c9ea08b938e6c8804cfe952f7a33c6739d3e3141 (diff) | |
download | gdb-eb28de4a09f016d3de7caccec781eb70995a4001.tar.gz |
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.
Diffstat (limited to 'gdb/gdbtypes.h')
-rw-r--r-- | gdb/gdbtypes.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index ddad0dcbdbf..2070f0006d9 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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; |