aboutsummaryrefslogtreecommitdiff
path: root/gdb/arm-tdep.c
diff options
context:
space:
mode:
authorRichard Earnshaw <richard.earnshaw@arm.com>2002-02-06 15:21:17 +0000
committerRichard Earnshaw <richard.earnshaw@arm.com>2002-02-06 15:21:17 +0000
commit082fc60dfca102f95d73f123f43060f3f34c0ff6 (patch)
tree5dc04f62e212f398c75d156e497d1ce3866a3016 /gdb/arm-tdep.c
parent039c576668f59aa4c66d02f3a31b533b799b11cb (diff)
downloadgdb-082fc60dfca102f95d73f123f43060f3f34c0ff6.zip
gdb-082fc60dfca102f95d73f123f43060f3f34c0ff6.tar.gz
gdb-082fc60dfca102f95d73f123f43060f3f34c0ff6.tar.bz2
* arm-tdep.c: Include elf-bfd.h and coff/internal.h.
(MSYMBOL_SET_SPECIAL, MSYMBOL_IS_SPECIAL, MSYMBOL_SIZE): Move defines to here from config/tm-arm.h. (coff_sym_is_thumb): Make static. (arm_elf_make_msymbol_special): New function. (arm_coff_make_msymbol_special): New function. * config/arm/tm-arm.h (MSYMBOL_SET_SPECIAL): Delete definition. (MSYMBOL_IS_SPECIAL, MSYMBOL_SIZE): Likewise. (coff_sym_is_thumb): Delete declaration. (arm_elf_make_msymbol_special): Declare. (arm_coff_make_msymbol_special): Declare. (ELF_MAKE_MSYMBOL_SPECIAL): Call arm_elf_make_msymbol_special. (COFF_MAKE_MSYMBOL_SPECIAL): Call arm_coff_make_msymbol_special.
Diffstat (limited to 'gdb/arm-tdep.c')
-rw-r--r--gdb/arm-tdep.c74
1 files changed, 60 insertions, 14 deletions
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 1726dad..3228842 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -33,6 +33,8 @@
#include "doublest.h"
#include "value.h"
#include "solib-svr4.h"
+#include "elf-bfd.h"
+#include "coff/internal.h"
/* Each OS has a different mechanism for accessing the various
registers stored in the sigcontext structure.
@@ -64,7 +66,27 @@
#define SIGCONTEXT_REGISTER_ADDRESS_P() 0
#endif
-extern void _initialize_arm_tdep (void);
+/* 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. This field is already being used to store
+ the symbol size, so the assumption is that the symbol size cannot
+ exceed 2^31.
+
+ MSYMBOL_SET_SPECIAL Actually sets the "special" bit.
+ MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol.
+ MSYMBOL_SIZE Returns the size of the minimal symbol,
+ i.e. the "info" field with the "special" bit
+ masked out. */
+
+#define MSYMBOL_SET_SPECIAL(msym) \
+ MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \
+ | 0x80000000)
+
+#define MSYMBOL_IS_SPECIAL(msym) \
+ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
+
+#define MSYMBOL_SIZE(msym) \
+ ((long) MSYMBOL_INFO (msym) & 0x7fffffff)
/* Number of different reg name sets (options). */
static int num_flavor_options;
@@ -2282,6 +2304,43 @@ arm_linux_svr4_fetch_link_map_offsets (void)
return lmp;
}
+/* Test whether the coff symbol specific value corresponds to a Thumb
+ function. */
+
+static int
+coff_sym_is_thumb (int val)
+{
+ return (val == C_THUMBEXT ||
+ val == C_THUMBSTAT ||
+ val == C_THUMBEXTFUNC ||
+ val == C_THUMBSTATFUNC ||
+ val == C_THUMBLABEL);
+}
+
+/* arm_coff_make_msymbol_special()
+ arm_elf_make_msymbol_special()
+
+ These functions test whether the COFF or ELF symbol corresponds to
+ an address in thumb code, and set a "special" bit in a minimal
+ symbol to indicate that it does. */
+
+void
+arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
+{
+ /* Thumb symbols are of type STT_LOPROC, (synonymous with
+ STT_ARM_TFUNC). */
+ if (ELF_ST_TYPE (((elf_symbol_type *)sym)->internal_elf_sym.st_info)
+ == STT_LOPROC)
+ MSYMBOL_SET_SPECIAL (msym);
+}
+
+void
+arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym)
+{
+ if (coff_sym_is_thumb (val))
+ MSYMBOL_SET_SPECIAL (msym);
+}
+
void
_initialize_arm_tdep (void)
{
@@ -2359,16 +2418,3 @@ The valid values are:\n");
prologue_cache.saved_regs = (CORE_ADDR *)
xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
}
-
-/* Test whether the coff symbol specific value corresponds to a Thumb
- function. */
-
-int
-coff_sym_is_thumb (int val)
-{
- return (val == C_THUMBEXT ||
- val == C_THUMBSTAT ||
- val == C_THUMBEXTFUNC ||
- val == C_THUMBSTATFUNC ||
- val == C_THUMBLABEL);
-}