mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 06:23:58 +08:00
gdb/
PR symtab/7259: * ada-exp.y (convert_char_literal): Use TYPE_FIELD_ENUMVAL. * ada-lang.c (ada_discrete_type_high_bound) (ada_discrete_type_low_bound): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (ada_identical_enum_types_p): Use TYPE_FIELD_ENUMVAL. (pos_atr, value_val_atr): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * ada-typeprint.c (print_enum_type): Change variable lastval to LONGEST. Use TYPE_FIELD_ENUMVAL. * ada-valprint.c (print_optional_low_bound, ada_print_scalar) (ada_val_print_1): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * c-typeprint.c (c_type_print_base): Move variable lastval to inner block, change it to LONGEST. Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * coffread.c (coff_read_enum_type): Use SET_FIELD_ENUMVAL. * dwarf2read.c (process_enumeration_scope): Likewise. * gdb-gdb.py (TypeFlagsPrinter): Use field.enumval instead of field.bitpos. (class StructMainTypePrettyPrinter): Support also FIELD_LOC_KIND_ENUMVAL. * gdbtypes.c (get_discrete_bounds): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (recursive_dump_type): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (copy_type_recursive): Support also FIELD_LOC_KIND_ENUMVAL. * gdbtypes.h (enum field_loc_kind): New FIELD_LOC_KIND_ENUMVAL. (struct main_type.flds_bnds.fields.loc): Adjust bitpos comment. New field enumval. (struct main_type.flds_bnds.bields): Adjust loc_kind and bitsize to accommodate enumval. (struct call_site): Adjust loc_kind to accommodate enumval. (FIELD_ENUMVAL, FIELD_ENUMVAL_LVAL, SET_FIELD_ENUMVAL) (TYPE_FIELD_ENUMVAL): New macros. * m2-typeprint.c (m2_enum): Use TYPE_FIELD_ENUMVAL. * mdebugread.c (parse_symbol): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * p-typeprint.c (pascal_type_print_base): Likewise. * python/lib/gdb/printing.py (class FlagEnumerationPrinter): Use enumval. * python/lib/gdb/types.py (make_enum_dict): Likewise. * python/py-type.c (convert_field): New variable addrstring. Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. (check_types_equal): Support also FIELD_LOC_KIND_ENUMVAL. * stabsread.c (read_enum_type): Use SET_FIELD_ENUMVAL. * typepint.c (print_type_scalar): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM. * valprint.c (generic_val_print): Likewise. gdb/testsuite/ PR symtab/7259: * gdb.base/enumval.c: New test case. * gdb.base/enumval.exp: New test case. * gdb.python/py-type.exp (test_enums): Use field.enumval instead of field.bitpos.
This commit is contained in:
@ -99,10 +99,10 @@ class TypeFlagsPrinter:
|
||||
return
|
||||
# Note: TYPE_FLAG_MIN is a duplicate of TYPE_FLAG_UNSIGNED,
|
||||
# so exclude it from the list we are building.
|
||||
TYPE_FLAGS = [TypeFlag(field.name, field.bitpos)
|
||||
TYPE_FLAGS = [TypeFlag(field.name, field.enumval)
|
||||
for field in flags.fields()
|
||||
if field.name != 'TYPE_FLAG_MIN']
|
||||
TYPE_FLAGS += [TypeFlag(field.name, field.bitpos)
|
||||
TYPE_FLAGS += [TypeFlag(field.name, field.enumval)
|
||||
for field in iflags.fields()]
|
||||
TYPE_FLAGS.sort()
|
||||
|
||||
@ -154,6 +154,8 @@ class StructMainTypePrettyPrinter:
|
||||
loc_kind = str(field_val['loc_kind'])
|
||||
if loc_kind == "FIELD_LOC_KIND_BITPOS":
|
||||
return 'bitpos = %d' % loc_val['bitpos']
|
||||
elif loc_kind == "FIELD_LOC_KIND_ENUMVAL":
|
||||
return 'enumval = %d' % loc_val['enumval']
|
||||
elif loc_kind == "FIELD_LOC_KIND_PHYSADDR":
|
||||
return 'physaddr = 0x%x' % loc_val['physaddr']
|
||||
elif loc_kind == "FIELD_LOC_KIND_PHYSNAME":
|
||||
|
Reference in New Issue
Block a user