diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2022-01-28 08:09:50 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-04-11 10:45:36 -0400 |
commit | 4aeddc50d7a06294cc124dfd8f43992ffa0b7382 (patch) | |
tree | 82c6a016c94112c6e5dc7cf763cc5641d91e6b6e /gdb/coffread.c | |
parent | 96d368d10456f5a599db759aab20e84a61f361f9 (diff) | |
download | gdb-4aeddc50d7a06294cc124dfd8f43992ffa0b7382.zip gdb-4aeddc50d7a06294cc124dfd8f43992ffa0b7382.tar.gz gdb-4aeddc50d7a06294cc124dfd8f43992ffa0b7382.tar.bz2 |
gdb: remove symbol value macros
Remove all macros related to getting and setting some symbol value:
#define SYMBOL_VALUE(symbol) (symbol)->value.ivalue
#define SYMBOL_VALUE_ADDRESS(symbol) \
#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
#define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue
#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0)
#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \
#define BMSYMBOL_VALUE_ADDRESS(symbol) \
#define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \
#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
Replace them with equivalent methods on the appropriate objects.
Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | gdb/coffread.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c index 253ba9c..24dd9b9 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1026,7 +1026,7 @@ coff_symtab_read (minimal_symbol_reader &reader, sym = process_coff_symbol (cs, &main_aux, objfile); - SYMBOL_VALUE (sym) = tmpaddr + offset; + sym->set_value_longest (tmpaddr + offset); sym->set_section_index (sec); } } @@ -1506,29 +1506,21 @@ patch_opaque_types (struct symtab *s) && strcmp (name + 1, sym->linkage_name () + 1) == 0) { if (prev) - { - SYMBOL_VALUE_CHAIN (prev) = SYMBOL_VALUE_CHAIN (sym); - } + prev->set_value_chain (sym->value_chain ()); else - { - opaque_type_chain[hash] = SYMBOL_VALUE_CHAIN (sym); - } + opaque_type_chain[hash] = sym->value_chain (); patch_type (sym->type (), real_sym->type ()); if (prev) - { - sym = SYMBOL_VALUE_CHAIN (prev); - } + sym = prev->value_chain (); else - { - sym = opaque_type_chain[hash]; - } + sym = opaque_type_chain[hash]; } else { prev = sym; - sym = SYMBOL_VALUE_CHAIN (sym); + sym->set_value_chain (sym); } } } @@ -1538,7 +1530,7 @@ patch_opaque_types (struct symtab *s) static int coff_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch) { - return gdbarch_sdb_reg_to_regnum (gdbarch, SYMBOL_VALUE (sym)); + return gdbarch_sdb_reg_to_regnum (gdbarch, sym->value_longest ()); } static const struct symbol_register_ops coff_register_funcs = { @@ -1564,13 +1556,14 @@ process_coff_symbol (struct coff_symbol *cs, sym->compute_and_set_names (name, true, objfile->per_bfd); /* default assumptions */ - SYMBOL_VALUE (sym) = cs->c_value; + sym->set_value_longest (cs->c_value); sym->set_domain (VAR_DOMAIN); sym->set_section_index (cs_to_section (cs, objfile)); if (ISFCN (cs->c_type)) { - SYMBOL_VALUE (sym) += objfile->text_section_offset (); + sym->set_value_longest + (sym->value_longest () + objfile->text_section_offset ()); sym->set_type (lookup_function_type (decode_function_type (cs, cs->c_type, aux, objfile))); @@ -1600,9 +1593,8 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBEXTFUNC: case C_EXT: sym->set_aclass_index (LOC_STATIC); - SET_SYMBOL_VALUE_ADDRESS (sym, - (CORE_ADDR) cs->c_value - + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); + sym->set_value_address ((CORE_ADDR) cs->c_value + + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); add_symbol_to_list (sym, get_global_symbols ()); break; @@ -1610,9 +1602,8 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBSTATFUNC: case C_STAT: sym->set_aclass_index (LOC_STATIC); - SET_SYMBOL_VALUE_ADDRESS (sym, - (CORE_ADDR) cs->c_value - + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); + sym->set_value_address ((CORE_ADDR) cs->c_value + + objfile->section_offsets[SECT_OFF_TEXT (objfile)]); if (within_function) { /* Static symbol of local scope. */ @@ -1630,7 +1621,7 @@ process_coff_symbol (struct coff_symbol *cs, #endif case C_REG: sym->set_aclass_index (coff_register_index); - SYMBOL_VALUE (sym) = cs->c_value; + sym->set_value_longest (cs->c_value); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1647,7 +1638,7 @@ process_coff_symbol (struct coff_symbol *cs, case C_REGPARM: sym->set_aclass_index (coff_register_index); sym->set_is_argument (1); - SYMBOL_VALUE (sym) = cs->c_value; + sym->set_value_longest (cs->c_value); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1698,7 +1689,7 @@ process_coff_symbol (struct coff_symbol *cs, { int i = hashname (sym->linkage_name ()); - SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i]; + sym->set_value_chain (opaque_type_chain[i]); opaque_type_chain[i] = sym; } add_symbol_to_list (sym, get_file_symbols ()); @@ -2100,7 +2091,7 @@ coff_read_enum_type (int index, int length, int lastsym, sym->set_linkage_name (name); sym->set_aclass_index (LOC_CONST); sym->set_domain (VAR_DOMAIN); - SYMBOL_VALUE (sym) = ms->c_value; + sym->set_value_longest (ms->c_value); add_symbol_to_list (sym, symlist); nsyms++; break; @@ -2145,8 +2136,8 @@ coff_read_enum_type (int index, int length, int lastsym, xsym->set_type (type); type->field (n).set_name (xsym->linkage_name ()); - type->field (n).set_loc_enumval (SYMBOL_VALUE (xsym)); - if (SYMBOL_VALUE (xsym) < 0) + type->field (n).set_loc_enumval (xsym->value_longest ()); + if (xsym->value_longest () < 0) unsigned_enum = 0; TYPE_FIELD_BITSIZE (type, n) = 0; } |