2002-06-15 Mark Kettenis <kettenis@gnu.org>
+ * config/i386/tm-i386.h (FUNCTION_START_OFFSET, INNER_THAN,
+ BREAKPOINT, DECR_PC_AFTER_BREAK): Removed.
+ * i386-tdep.c (i386_skip_prologue): Adjust function signature to
+ fit into multi-arch framework.
+ (i386_breakpoint_from_pc): New function.
+ (i386_gdbarch_init): Adjust for removal of the macros mentioned
+ above.
+
* config/i386/tm-i386.h (FRAMELESS_FUNCTION_INVOCATION,
FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS, FRAME_NUM_ARGS,
FRAME_ARGS_SKIP, FRAME_INIT_SAVED_REGS): Remove defines.
struct value;
struct type;
-/* Offset from address of function to start of its code.
- Zero on most machines. */
-
-#define FUNCTION_START_OFFSET 0
-
-/* Advance PC across any function entry prologue instructions to reach some
- "real" code. */
-
-#define SKIP_PROLOGUE(frompc) (i386_skip_prologue (frompc))
-
-extern int i386_skip_prologue (int);
-
-/* Stack grows downward. */
-
-#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
-
-/* Sequence of bytes for breakpoint instruction. */
-
-#define BREAKPOINT {0xcc}
-
-/* Amount PC must be decremented by after a breakpoint. This is often the
- number of bytes in BREAKPOINT but not always. */
-
-#define DECR_PC_AFTER_BREAK 1
-\f
-
/* Return the GDB type object for the "standard" data type of data in
register REGNUM. */
/* Return PC of first real instruction. */
-int
-i386_skip_prologue (int pc)
+CORE_ADDR
+i386_skip_prologue (CORE_ADDR pc)
{
unsigned char op;
int i;
return (codestream_tell ());
}
+/* Use the program counter to determine the contents and size of a
+ breakpoint instruction. Return a pointer to a string of bytes that
+ encode a breakpoint instruction, store the length of the string in
+ *LEN and optionally adjust *PC to point to the correct memory
+ location for inserting the breakpoint.
+
+ On the i386 we have a single breakpoint that fits in a single byte
+ and can be inserted anywhere. */
+
+static const unsigned char *
+i386_breakpoint_from_pc (CORE_ADDR *pc, int *len)
+{
+ static unsigned char break_insn[] = { 0xcc }; /* int 3 */
+
+ *len = sizeof (break_insn);
+ return break_insn;
+}
+
void
i386_push_dummy_frame (void)
{
set_gdbarch_use_struct_convention (gdbarch, i386_use_struct_convention);
set_gdbarch_frame_init_saved_regs (gdbarch, i386_frame_init_saved_regs);
+ set_gdbarch_skip_prologue (gdbarch, i386_skip_prologue);
+
+ /* Stack grows downward. */
+ set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+
+ set_gdbarch_breakpoint_from_pc (gdbarch, i386_breakpoint_from_pc);
+ set_gdbarch_decr_pc_after_break (gdbarch, 1);
+ set_gdbarch_function_start_offset (gdbarch, 0);
/* The following redefines make backtracing through sigtramp work.
They manufacture a fake sigtramp frame and obtain the saved pc in