This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Multi-arch i386 misc


Here's some more stuff.

Checked in.

Index: ChangeLog
from  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.

Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.61
diff -u -p -r1.61 i386-tdep.c
--- i386-tdep.c 15 Jun 2002 19:59:07 -0000 1.61
+++ i386-tdep.c 15 Jun 2002 20:40:18 -0000
@@ -666,8 +666,8 @@ i386_frame_init_saved_regs (struct frame
 
 /* 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 i
   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
Index: config/i386/tm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-i386.h,v
retrieving revision 1.37
diff -u -p -r1.37 tm-i386.h
--- config/i386/tm-i386.h 15 Jun 2002 19:59:08 -0000 1.37
+++ config/i386/tm-i386.h 15 Jun 2002 20:40:18 -0000
@@ -32,32 +32,6 @@ struct frame_saved_regs;
 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
-
-
 /* Return the GDB type object for the "standard" data type of data in
    register REGNUM.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]