This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
[rfc] msym.tdep_flags
- From: mec dot gnu at mindspring dot com (Michael Elizabeth Chastain)
- To: ezannoni at redhat dot com, jimb at redhat dot com
- Cc: gdb at sources dot redhat dot com
- Date: Tue, 11 Nov 2003 16:50:34 -0500 (EST)
- Subject: [rfc] msym.tdep_flags
Here is the next step in my project to get rid of msymbol.info.
msymbol.info originally had three uses:
(1) coff storage class, mercy-killed by elena
(2) elf symbol size, moved to a separate field by mec
(3) target-dependent flag bits
I would like to go after (3) the same way I went after (2).
I want to do this:
(3A) add a "tdep_flags" field to struct minimal_symbol
(3B) convert each *-tdep.c file to use the new field, one by one
Here are some diffs to illustrate the idea. These are just to
show the idea -- I'm asking for comments, not approval.
Should I pursue this approach, or should I do something different?
Michael C
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.83
diff -u -r1.83 symtab.h
--- symtab.h 11 Nov 2003 20:04:52 -0000 1.83
+++ symtab.h 11 Nov 2003 20:17:02 -0000
@@ -336,6 +336,9 @@
char *filename;
#endif
+ /* Target-specific flag bits. */
+ unsigned int tdep_flags : 8;
+
/* Classification type for this minimal symbol. */
ENUM_BITFIELD(minimal_symbol_type) type : 8;
@@ -353,6 +356,7 @@
#define MSYMBOL_INFO(msymbol) (msymbol)->info
#define MSYMBOL_SIZE(msymbol) (msymbol)->size
+#define MSYMBOL_TDEP_FLAGS(msymbol) (msymbol)->tdep_flags
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.155
diff -u -r1.155 arm-tdep.c
--- arm-tdep.c 11 Nov 2003 20:04:52 -0000 1.155
+++ arm-tdep.c 11 Nov 2003 20:37:03 -0000
@@ -80,18 +80,16 @@
#endif
/* Macros for setting and testing a bit in a minimal symbol that marks
- it as Thumb function. The MSB of the minimal symbol's "info" field
- is used for this purpose.
+ it as Thumb function.
MSYMBOL_SET_SPECIAL Actually sets the "special" bit.
MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. */
#define MSYMBOL_SET_SPECIAL(msym) \
- MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \
- | 0x80000000)
+ MSYMBOL_TDEP_FLAGS(msym) |= 0x01
#define MSYMBOL_IS_SPECIAL(msym) \
- (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
+ ((MSYMBOL_TDEP_FLAGS(msym)) & 0x01 != 0)
/* The list of available "set arm ..." and "show arm ..." commands. */
static struct cmd_list_element *setarmcmdlist = NULL;
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.93
diff -u -r1.93 m68hc11-tdep.c
--- m68hc11-tdep.c 11 Nov 2003 20:04:52 -0000 1.93
+++ m68hc11-tdep.c 11 Nov 2003 20:37:03 -0000
@@ -49,26 +49,22 @@
type the function is using. This is used for prologue and frame
analysis to compute correct stack frame layout.
- The MSB of the minimal symbol's "info" field is used for this purpose.
-
MSYMBOL_SET_RTC Actually sets the "RTC" bit.
MSYMBOL_SET_RTI Actually sets the "RTI" bit.
MSYMBOL_IS_RTC Tests the "RTC" bit in a minimal symbol.
MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. */
#define MSYMBOL_SET_RTC(msym) \
- MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \
- | 0x80000000)
+ MSYMBOL_TDEP_FLAGS (msym) |= 0x01
#define MSYMBOL_SET_RTI(msym) \
- MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \
- | 0x40000000)
+ MSYMBOL_TDEP_FLAGS (msym) |= 0x02
#define MSYMBOL_IS_RTC(msym) \
- (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
+ ((MSYMBOL_TDEP_FLAGS (msym) & 0x01) != 0)
#define MSYMBOL_IS_RTI(msym) \
- (((long) MSYMBOL_INFO (msym) & 0x40000000) != 0)
+ ((MSYMBOL_TDEP_FLAGS (msym) & 0x02) != 0)
enum insn_return_kind {
RETURN_RTS,
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.244
diff -u -r1.244 mips-tdep.c
--- mips-tdep.c 11 Nov 2003 20:04:52 -0000 1.244
+++ mips-tdep.c 11 Nov 2003 20:37:09 -0000
@@ -239,8 +239,7 @@
{
if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_MIPS16)
{
- MSYMBOL_INFO (msym) = (char *)
- (((long) MSYMBOL_INFO (msym)) | 0x80000000);
+ MSYMBOL_TDEP_FLAGS (msym) |= 0x01;
SYMBOL_VALUE_ADDRESS (msym) |= 1;
}
}
@@ -248,7 +247,7 @@
static int
msymbol_is_special (struct minimal_symbol *msym)
{
- return (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0);
+ return ((MSYMBOL_TDEP_FLAGS (msym) & 0x01) != 0);
}
static long
Index: sh64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh64-tdep.c,v
retrieving revision 1.12
diff -u -r1.12 sh64-tdep.c
--- sh64-tdep.c 11 Nov 2003 20:04:52 -0000 1.12
+++ sh64-tdep.c 11 Nov 2003 20:37:11 -0000
@@ -206,7 +206,7 @@
MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol */
#define MSYMBOL_IS_SPECIAL(msym) \
- (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
+ ((MSYMBOL_TDEP_FLAGS (msym) & 0x01) != 0)
static void
sh64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
@@ -216,7 +216,7 @@
if (((elf_symbol_type *)(sym))->internal_elf_sym.st_other == STO_SH5_ISA32)
{
- MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) | 0x80000000);
+ MSYMBOL_TDEP_FLAGS (msym) |= 0x01;
SYMBOL_VALUE_ADDRESS (msym) |= 1;
}
}