This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 3/9] make MSYMBOL_VALUE_ADDRESS an rvalue
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Thu, 17 Oct 2013 11:49:47 -0600
- Subject: [PATCH v2 3/9] make MSYMBOL_VALUE_ADDRESS an rvalue
- Authentication-results: sourceware.org; auth=none
- References: <1382032193-9115-1-git-send-email-tromey at redhat dot com>
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.
* 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/minsyms.c | 2 +-
gdb/objfiles.c | 5 +++--
gdb/sh64-tdep.c | 2 +-
gdb/symtab.h | 4 +++-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index f2d6459..796cb5e 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -946,7 +946,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 36a956d..af4a691 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -812,8 +812,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 eb661db..58e8443 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 80f8e35..61cb25f 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
--
1.8.1.4