From cafec441901459c36ad92f1cd9eef648534ea53b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 16 Jan 2012 19:44:16 +0000 Subject: gdb PR python/13281: * gdbtypes.h (TYPE_FLAG_ENUM): New macro. (struct main_type) : New field. * dwarf2read.c (process_enumeration_scope): Detect "flag" enums. * NEWS: Add entries. * c-valprint.c (c_val_print) : 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. --- gdb/NEWS | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gdb/NEWS') diff --git a/gdb/NEWS b/gdb/NEWS index c5ceccc..02082a3 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -13,6 +13,18 @@ * The binary "gdbtui" can no longer be built or installed. Use "gdb -tui" instead. +* GDB will now print "flag" enums specially. A flag enum is one where + all the enumerator values have no bits in common when pairwise + "and"ed. When printing a value whose type is a flag enum, GDB will + show all the constants, e.g., for enum E { ONE = 1, TWO = 2}: + (gdb) print (enum E) 3 + $1 = (ONE | TWO) + +* Python scripting + + ** A new class, gdb.printing.FlagEnumerationPrinter, can be used to + apply "flag enum"-style pretty-printing to any enum. + *** Changes in GDB 7.4 * GDB now handles ambiguous linespecs more consistently; the existing -- cgit v1.1