From 40c1a0073715c1e3f93afc83edac8396eb362a98 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 15 Aug 2013 08:44:43 -0600 Subject: [PATCH] make MSYMBOL_VALUE_ADDRESS an rvalue This changes MSYMBOL_VALUE_ADDRESS to be an rvalue. In a later patch we change this macro to compute its value; this patch introduces a setter to make the break a bit cleaner. 2014-02-26 Tom Tromey * minsyms.c (prim_record_minimal_symbol_full): Use SET_MSYMBOL_VALUE_ADDRESS. * objfiles.c (objfile_relocate1): Use SET_MSYMBOL_VALUE_ADDRESS. * sh64-tdep.c (sh64_elf_make_msymbol_special): Use SET_MSYMBOL_VALUE_ADDRESS. * symtab.h (MSYMBOL_VALUE_ADDRESS): Expand to an rvalue. (SET_MSYMBOL_VALUE_ADDRESS): New macro. --- gdb/ChangeLog | 10 ++++++++++ gdb/minsyms.c | 2 +- gdb/objfiles.c | 5 +++-- gdb/sh64-tdep.c | 2 +- gdb/symtab.h | 4 +++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3d3140ca4d9..0f44e5c2b7f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2014-02-26 Tom Tromey + + * minsyms.c (prim_record_minimal_symbol_full): Use + SET_MSYMBOL_VALUE_ADDRESS. + * objfiles.c (objfile_relocate1): Use SET_MSYMBOL_VALUE_ADDRESS. + * sh64-tdep.c (sh64_elf_make_msymbol_special): Use + SET_MSYMBOL_VALUE_ADDRESS. + * symtab.h (MSYMBOL_VALUE_ADDRESS): Expand to an rvalue. + (SET_MSYMBOL_VALUE_ADDRESS): New macro. + 2014-02-26 Tom Tromey * symtab.h (struct minimal_symbol) : Rename from ginfo. diff --git a/gdb/minsyms.c b/gdb/minsyms.c index aad7685f4d1..dde7d903fcf 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -944,7 +944,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name, MSYMBOL_SET_LANGUAGE (msymbol, language_auto, &objfile->objfile_obstack); MSYMBOL_SET_NAMES (msymbol, name, name_len, copy_name, objfile); - MSYMBOL_VALUE_ADDRESS (msymbol) = address; + SET_MSYMBOL_VALUE_ADDRESS (msymbol, address); MSYMBOL_SECTION (msymbol) = section; MSYMBOL_TYPE (msymbol) = ms_type; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 89b8943bbf5..dba13fbbfba 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -805,8 +805,9 @@ objfile_relocate1 (struct objfile *objfile, ALL_OBJFILE_MSYMBOLS (objfile, msym) if (MSYMBOL_SECTION (msym) >= 0) - MSYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, - MSYMBOL_SECTION (msym)); + SET_MSYMBOL_VALUE_ADDRESS (msym, (MSYMBOL_VALUE_ADDRESS (msym) + + ANOFFSET (delta, + MSYMBOL_SECTION (msym)))); } /* Relocating different sections by different amounts may cause the symbols to be out of order. */ diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index ab1c96d5e8a..cf93d53132e 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -224,7 +224,7 @@ sh64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_SH5_ISA32) { MSYMBOL_TARGET_FLAG_1 (msym) = 1; - MSYMBOL_VALUE_ADDRESS (msym) |= 1; + SET_MSYMBOL_VALUE_ADDRESS (msym, MSYMBOL_VALUE_ADDRESS (msym) | 1); } } diff --git a/gdb/symtab.h b/gdb/symtab.h index 4bf30358e74..bf1ef74185d 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -391,7 +391,9 @@ struct minimal_symbol #define MSYMBOL_TYPE(msymbol) (msymbol)->type #define MSYMBOL_VALUE(symbol) (symbol)->mginfo.value.ivalue -#define MSYMBOL_VALUE_ADDRESS(symbol) (symbol)->mginfo.value.address +#define MSYMBOL_VALUE_ADDRESS(symbol) ((symbol)->mginfo.value.address + 0) +#define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \ + ((symbol)->mginfo.value.address = (new_value)) #define MSYMBOL_VALUE_BYTES(symbol) (symbol)->mginfo.value.bytes #define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->mginfo.value.block #define MSYMBOL_VALUE_CHAIN(symbol) (symbol)->mginfo.value.chain -- 2.30.2