This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
PATCH arm - make XXX_MAKE_MSYMBOL_SPECIAL call functions
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: Richard dot Earnshaw at arm dot com
- Date: Wed, 06 Feb 2002 15:24:59 +0000
- Subject: PATCH arm - make XXX_MAKE_MSYMBOL_SPECIAL call functions
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
Using the code that Elena has just committed, this makes the ARM back-ends
call functions for these actions.
Committed as obvious for multi-arch.
2002-02-06 Richard Earnshaw <rearnsha@arm.com>
* 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.
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.35
diff -p -r1.35 arm-tdep.c
*** arm-tdep.c 2002/02/06 13:12:14 1.35
--- arm-tdep.c 2002/02/06 15:14:11
***************
*** 33,38 ****
--- 33,40 ----
#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,71 ****
#define SIGCONTEXT_REGISTER_ADDRESS_P() 0
#endif
! extern void _initialize_arm_tdep (void);
/* Number of different reg name sets (options). */
static int num_flavor_options;
--- 66,93 ----
#define SIGCONTEXT_REGISTER_ADDRESS_P() 0
#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. 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;
*************** arm_linux_svr4_fetch_link_map_offsets (v
*** 2282,2287 ****
--- 2304,2346 ----
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)
{
*************** The valid values are:\n");
*** 2358,2374 ****
xcalloc (1, sizeof (struct frame_extra_info));
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);
}
--- 2417,2420 ----
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.22
diff -p -r1.22 tm-arm.h
*** tm-arm.h 2002/02/06 13:00:47 1.22
--- tm-arm.h 2002/02/06 15:14:18
*************** void arm_software_single_step (int, int)
*** 409,450 ****
CORE_ADDR arm_get_next_pc (CORE_ADDR pc);
- /* 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.
! COFF_MAKE_MSYMBOL_SPECIAL
! ELF_MAKE_MSYMBOL_SPECIAL
!
! These macros test whether the COFF or ELF symbol corresponds to a
! thumb function, and set a "special" bit in a minimal symbol to
! indicate that it does.
!
! 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
! */
! extern int coff_sym_is_thumb (int val);
! #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)
!
! /* Thumb symbols are of type STT_LOPROC, (synonymous with STT_ARM_TFUNC) */
! #define ELF_MAKE_MSYMBOL_SPECIAL(sym,msym) \
! { if(ELF_ST_TYPE(((elf_symbol_type *)(sym))->internal_elf_sym.st_info) == STT_LOPROC) \
! MSYMBOL_SET_SPECIAL(msym); }
!
! #define COFF_MAKE_MSYMBOL_SPECIAL(val,msym) \
! { if(coff_sym_is_thumb(val)) MSYMBOL_SET_SPECIAL(msym); }
/* The first 0x20 bytes are the trap vectors. */
#define LOWEST_PC 0x20
--- 409,424 ----
CORE_ADDR arm_get_next_pc (CORE_ADDR pc);
! struct minimal_symbol;
! void arm_elf_make_msymbol_special(asymbol *, struct minimal_symbol *);
! #define ELF_MAKE_MSYMBOL_SPECIAL(SYM,MSYM) \
! arm_elf_make_msymbol_special (SYM, MSYM)
! void arm_coff_make_msymbol_special(int, struct minimal_symbol *);
! #define COFF_MAKE_MSYMBOL_SPECIAL(VAL,MSYM) \
! arm_coff_make_msymbol_special (VAL, MSYM)
/* The first 0x20 bytes are the trap vectors. */
#define LOWEST_PC 0x20