diff options
author | Tom Tromey <tromey@adacore.com> | 2019-06-25 11:53:11 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2019-10-02 09:53:17 -0600 |
commit | 38583298e0ab81ab78689d89abcb5122e0251c74 (patch) | |
tree | 2b36a7aa7b2874177aacd6ce83ad7b0f4256ab99 /gdb | |
parent | 9344c18feb0ef3dfacfd1d0437c0d1e329feaa83 (diff) | |
download | gdb-38583298e0ab81ab78689d89abcb5122e0251c74.zip gdb-38583298e0ab81ab78689d89abcb5122e0251c74.tar.gz gdb-38583298e0ab81ab78689d89abcb5122e0251c74.tar.bz2 |
Change SYMBOL_VALUE_ADDRESS to be an rvalue
This changes SYMBOL_VALUE_ADDRESS to be an rvalue. The symbol readers
generally assign using this, so this also introduces
SET_SYMBOL_VALUE_ADDRESS and updates the readers. Making this change
is useful in a subsequent patch, which redefined SYMBOL_VALUE_ADDRESS.
gdb/ChangeLog
2019-10-02 Tom Tromey <tromey@adacore.com>
* coffread.c (process_coff_symbol): Update.
* dwarf2read.c (var_decode_location, new_symbol): Update.
* mdebugread.c (parse_symbol): Update.
* objfiles.c (relocate_one_symbol): Update.
* stabsread.c (define_symbol, fix_common_block)
(scan_file_globals): Update.
* symtab.h (SYMBOL_VALUE_ADDRESS): Expand to an rvalue.
(SET_SYMBOL_VALUE_ADDRESS): New macro.
* xcoffread.c (process_xcoff_symbol): Update.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/coffread.c | 14 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 19 | ||||
-rw-r--r-- | gdb/mdebugread.c | 6 | ||||
-rw-r--r-- | gdb/objfiles.c | 4 | ||||
-rw-r--r-- | gdb/stabsread.c | 22 | ||||
-rw-r--r-- | gdb/symtab.h | 4 | ||||
-rw-r--r-- | gdb/xcoffread.c | 6 |
8 files changed, 58 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 90bf154..aa52463 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2019-10-02 Tom Tromey <tromey@adacore.com> + + * coffread.c (process_coff_symbol): Update. + * dwarf2read.c (var_decode_location, new_symbol): Update. + * mdebugread.c (parse_symbol): Update. + * objfiles.c (relocate_one_symbol): Update. + * stabsread.c (define_symbol, fix_common_block) + (scan_file_globals): Update. + * symtab.h (SYMBOL_VALUE_ADDRESS): Expand to an rvalue. + (SET_SYMBOL_VALUE_ADDRESS): New macro. + * xcoffread.c (process_xcoff_symbol): Update. + 2019-10-02 Andreas Arnez <arnez@linux.ibm.com> * MAINTAINERS: Update my email address. diff --git a/gdb/coffread.c b/gdb/coffread.c index c44b690..869a32b 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1609,9 +1609,10 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBEXTFUNC: case C_EXT: SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; - SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value; - SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT (objfile)); + SET_SYMBOL_VALUE_ADDRESS (sym, + (CORE_ADDR) cs->c_value + + ANOFFSET (objfile->section_offsets, + SECT_OFF_TEXT (objfile))); add_symbol_to_list (sym, get_global_symbols ()); break; @@ -1619,9 +1620,10 @@ process_coff_symbol (struct coff_symbol *cs, case C_THUMBSTATFUNC: case C_STAT: SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; - SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value; - SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT (objfile)); + SET_SYMBOL_VALUE_ADDRESS (sym, + (CORE_ADDR) cs->c_value + + ANOFFSET (objfile->section_offsets, + SECT_OFF_TEXT (objfile))); if (within_function) { /* Static symbol of local scope. */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 30658b2..f10f384 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -21495,15 +21495,20 @@ var_decode_location (struct attribute *attr, struct symbol *sym, unsigned int dummy; if (DW_BLOCK (attr)->data[0] == DW_OP_addr) - SYMBOL_VALUE_ADDRESS (sym) = - read_address (objfile->obfd, DW_BLOCK (attr)->data + 1, cu, &dummy); + SET_SYMBOL_VALUE_ADDRESS (sym, + read_address (objfile->obfd, + DW_BLOCK (attr)->data + 1, + cu, &dummy)); else - SYMBOL_VALUE_ADDRESS (sym) = - read_addr_index_from_leb128 (cu, DW_BLOCK (attr)->data + 1, &dummy); + SET_SYMBOL_VALUE_ADDRESS + (sym, read_addr_index_from_leb128 (cu, DW_BLOCK (attr)->data + 1, + &dummy)); SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; fixup_symbol_section (sym, objfile); - SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, - SYMBOL_SECTION (sym)); + SET_SYMBOL_VALUE_ADDRESS (sym, + SYMBOL_VALUE_ADDRESS (sym) + + ANOFFSET (objfile->section_offsets, + SYMBOL_SECTION (sym))); return; } @@ -21617,7 +21622,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, addr = attr_value_as_address (attr); addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr + baseaddr); - SYMBOL_VALUE_ADDRESS (sym) = addr; + SET_SYMBOL_VALUE_ADDRESS (sym, addr); } SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_core_addr; SYMBOL_DOMAIN (sym) = LABEL_DOMAIN; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 0956fbd..eed7146 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -632,7 +632,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (top_stack->cur_st), GLOBAL_BLOCK); s = new_symbol (name); - SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value; + SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name); break; @@ -649,7 +649,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, global_sym_chain[bucket] = s; } else - SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value; + SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name); break; @@ -706,7 +706,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (name); SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* So that it can be used */ SYMBOL_ACLASS_INDEX (s) = LOC_LABEL; /* but not misused. */ - SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value; + SET_SYMBOL_VALUE_ADDRESS (s, (CORE_ADDR) sh->value); SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int; add_symbol (s, top_stack->cur_st, top_stack->cur_block); break; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 90c4650..f9e7d20 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -707,7 +707,9 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile, || SYMBOL_CLASS (sym) == LOC_STATIC) && SYMBOL_SECTION (sym) >= 0) { - SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (delta, SYMBOL_SECTION (sym)); + SET_SYMBOL_VALUE_ADDRESS (sym, + SYMBOL_VALUE_ADDRESS (sym) + + ANOFFSET (delta, SYMBOL_SECTION (sym))); } } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 48c88de..da455da 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -942,7 +942,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - SYMBOL_VALUE_ADDRESS (sym) = valu; + SET_SYMBOL_VALUE_ADDRESS (sym, valu); add_symbol_to_list (sym, get_local_symbols ()); break; @@ -1188,7 +1188,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Static symbol at top level of file. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; - SYMBOL_VALUE_ADDRESS (sym) = valu; + SET_SYMBOL_VALUE_ADDRESS (sym, valu); if (gdbarch_static_transform_name_p (gdbarch) && gdbarch_static_transform_name (gdbarch, SYMBOL_LINKAGE_NAME (sym)) @@ -1204,7 +1204,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, (gdbarch, SYMBOL_LINKAGE_NAME (sym)); SYMBOL_SET_LINKAGE_NAME (sym, new_name); - SYMBOL_VALUE_ADDRESS (sym) = BMSYMBOL_VALUE_ADDRESS (msym); + SET_SYMBOL_VALUE_ADDRESS (sym, + BMSYMBOL_VALUE_ADDRESS (msym)); } } SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -1380,7 +1381,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, /* Static symbol of local scope. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC; - SYMBOL_VALUE_ADDRESS (sym) = valu; + SET_SYMBOL_VALUE_ADDRESS (sym, valu); if (gdbarch_static_transform_name_p (gdbarch) && gdbarch_static_transform_name (gdbarch, SYMBOL_LINKAGE_NAME (sym)) @@ -1396,7 +1397,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, (gdbarch, SYMBOL_LINKAGE_NAME (sym)); SYMBOL_SET_LINKAGE_NAME (sym, new_name); - SYMBOL_VALUE_ADDRESS (sym) = BMSYMBOL_VALUE_ADDRESS (msym); + SET_SYMBOL_VALUE_ADDRESS (sym, BMSYMBOL_VALUE_ADDRESS (msym)); } } SYMBOL_DOMAIN (sym) = VAR_DOMAIN; @@ -4363,7 +4364,9 @@ fix_common_block (struct symbol *sym, CORE_ADDR valu) int j; for (j = next->nsyms - 1; j >= 0; j--) - SYMBOL_VALUE_ADDRESS (next->symbol[j]) += valu; + SET_SYMBOL_VALUE_ADDRESS (next->symbol[j], + SYMBOL_VALUE_ADDRESS (next->symbol[j]) + + valu); } } @@ -4641,8 +4644,9 @@ scan_file_globals (struct objfile *objfile) } else { - SYMBOL_VALUE_ADDRESS (sym) - = MSYMBOL_VALUE_ADDRESS (resolve_objfile, msymbol); + SET_SYMBOL_VALUE_ADDRESS + (sym, MSYMBOL_VALUE_ADDRESS (resolve_objfile, + msymbol)); } SYMBOL_SECTION (sym) = MSYMBOL_SECTION (msymbol); } @@ -4680,7 +4684,7 @@ scan_file_globals (struct objfile *objfile) /* Change the symbol address from the misleading chain value to address zero. */ - SYMBOL_VALUE_ADDRESS (prev) = 0; + SET_SYMBOL_VALUE_ADDRESS (prev, 0); /* Complain about unresolved common block symbols. */ if (SYMBOL_CLASS (prev) == LOC_STATIC) diff --git a/gdb/symtab.h b/gdb/symtab.h index 1f0fc62..e9024a0 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -463,7 +463,9 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); field only, instead of the SYMBOL parameter. */ #define SYMBOL_VALUE(symbol) (symbol)->ginfo.value.ivalue -#define SYMBOL_VALUE_ADDRESS(symbol) (symbol)->ginfo.value.address +#define SYMBOL_VALUE_ADDRESS(symbol) ((symbol)->ginfo.value.address + 0) +#define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \ + ((symbol)->ginfo.value.address = (new_value)) #define SYMBOL_VALUE_BYTES(symbol) (symbol)->ginfo.value.bytes #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->ginfo.value.common_block #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->ginfo.value.block diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 2fa2706..aec1923 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1576,7 +1576,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) initialize_objfile_symbol (sym); /* default assumptions */ - SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off; + SET_SYMBOL_VALUE_ADDRESS (sym, cs->c_value + off); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_SECTION (sym) = secnum_to_section (cs->c_secnum, objfile); @@ -1674,7 +1674,9 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile) cs->c_name, 0, 0, objfile); if (sym != NULL) { - SYMBOL_VALUE_ADDRESS (sym) += static_block_base; + SET_SYMBOL_VALUE_ADDRESS (sym, + SYMBOL_VALUE_ADDRESS (sym) + + static_block_base); SYMBOL_SECTION (sym) = static_block_section; } return sym; |