aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2002-06-15 20:41:51 +0000
committerMark Kettenis <kettenis@gnu.org>2002-06-15 20:41:51 +0000
commit93924b6b9955c51cd5a6d8444c9eaa818e2a6545 (patch)
tree13ddcc1f7ba093f442fb5c5edb4edd108a8c89e2 /gdb/i386-tdep.c
parent42fdc8df2fb4328db6e2e6682b1327b6cf34beae (diff)
downloadgdb-93924b6b9955c51cd5a6d8444c9eaa818e2a6545.zip
gdb-93924b6b9955c51cd5a6d8444c9eaa818e2a6545.tar.gz
gdb-93924b6b9955c51cd5a6d8444c9eaa818e2a6545.tar.bz2
* 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.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 250d1c2..9739015 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -666,8 +666,8 @@ i386_frame_init_saved_regs (struct frame_info *fip)
/* 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;
@@ -749,6 +749,24 @@ i386_skip_prologue (int pc)
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)
{
@@ -1402,6 +1420,14 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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