diff options
author | Richard Earnshaw <richard.earnshaw@arm.com> | 2002-02-18 16:42:54 +0000 |
---|---|---|
committer | Richard Earnshaw <richard.earnshaw@arm.com> | 2002-02-18 16:42:54 +0000 |
commit | 3fb4b924b5512f38042274c62aff457ba3c0d716 (patch) | |
tree | 3bffc432253b8b2777d882050cb7a10b33e572f2 | |
parent | 5a8b245cb68e0f6c6fadc2b49b39227556afceaa (diff) | |
download | gdb-3fb4b924b5512f38042274c62aff457ba3c0d716.zip gdb-3fb4b924b5512f38042274c62aff457ba3c0d716.tar.gz gdb-3fb4b924b5512f38042274c62aff457ba3c0d716.tar.bz2 |
* arm-tdep.c (arm_set_call_dummy_breakpoint_offset): New function.
(arm_fix_call_dummy): Call it.
(arm_call_dummy_breakpoint_offset): Delete.
(arm_gdbarch_init): Initialize call_dummy_breakpoint_offset.
* config/arm/tm-arm.h (CALL_DUMMY_BREAKPOINT_OFFSET): Delete.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 39 | ||||
-rw-r--r-- | gdb/config/arm/tm-arm.h | 4 |
3 files changed, 31 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ab9e7a3..4e7c933 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2002-02-18 Richard Earnshaw <rearnsha@arm.com> + + * arm-tdep.c (arm_set_call_dummy_breakpoint_offset): New function. + (arm_fix_call_dummy): Call it. + (arm_call_dummy_breakpoint_offset): Delete. + (arm_gdbarch_init): Initialize call_dummy_breakpoint_offset. + * config/arm/tm-arm.h (CALL_DUMMY_BREAKPOINT_OFFSET): Delete. + 2002-02-18 Andrew Cagney <ac131313@redhat.com> * gdbarch.sh (FRAME_CHAIN_VALID): Only require at level 2. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 806cd08..62dc81f 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1263,6 +1263,25 @@ static LONGEST arm_call_dummy_words[] = 0xe1a0e00f, 0xe1a0f004, 0xe7ffdefe }; +/* Adjust the call_dummy_breakpoint_offset for the bp_call_dummy + breakpoint to the proper address in the call dummy, so that + `finish' after a stop in a call dummy works. + + XXX Tweeking current_gdbarch is not an optimal solution, but the + call to arm_fix_call_dummy is immediately followed by a call to + run_stack_dummy, which is the only function where + call_dummy_breakpoint_offset is actually used. */ + + +static void +arm_set_call_dummy_breakpoint_offset (void) +{ + if (caller_is_thumb) + set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 4); + else + set_gdbarch_call_dummy_breakpoint_offset (current_gdbarch, 8); +} + /* Fix up the call dummy, based on whether the processor is currently in Thumb or ARM mode, and whether the target function is Thumb or ARM. There are three different situations requiring three @@ -1292,6 +1311,7 @@ arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, /* Set flag indicating whether the current PC is in a Thumb function. */ caller_is_thumb = arm_pc_is_thumb (read_pc ()); + arm_set_call_dummy_breakpoint_offset (); /* If the target function is Thumb, set the low bit of the function address. And if the CPU is currently in ARM mode, patch the @@ -1326,22 +1346,6 @@ arm_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, write_register (4, fun); } -/* Return the offset in the call dummy of the instruction that needs - to have a breakpoint placed on it. This is the offset of the 'swi - 24' instruction, which is no longer actually used, but simply acts - as a place-holder now. - - This implements the CALL_DUMMY_BREAK_OFFSET macro. */ - -int -arm_call_dummy_breakpoint_offset (void) -{ - if (caller_is_thumb) - return 4; - else - return 8; -} - /* Note: ScottB This function does not support passing parameters using the FPA @@ -2801,6 +2805,9 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Call dummy code. */ set_gdbarch_call_dummy_location (gdbarch, ON_STACK); set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1); + /* We have to give this a value now, even though we will re-set it + during each call to arm_fix_call_dummy. */ + set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 8); set_gdbarch_call_dummy_p (gdbarch, 1); set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); diff --git a/gdb/config/arm/tm-arm.h b/gdb/config/arm/tm-arm.h index 79a57cf..3699175 100644 --- a/gdb/config/arm/tm-arm.h +++ b/gdb/config/arm/tm-arm.h @@ -30,9 +30,5 @@ lexical context are listed after the beginning LBRAC instead of before in the executables list of symbols. */ #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p)) - -/* XXX This is NOT multi-arch compatible. */ -#define CALL_DUMMY_BREAKPOINT_OFFSET arm_call_dummy_breakpoint_offset() -extern int arm_call_dummy_breakpoint_offset (void); #endif /* TM_ARM_H */ |