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/i386newframe] Some cleanups in i386-specific files


This fixes some inconsistencies with the rest of the code.

Checked in.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* i386-tdep.c (i386_unwind_dummy_id): Use extract_unsigned_integer
	instead of extract_typed_address for consistency with the rest of
	the code in this file.
	* i386-linux-tdep.c: Fix formatting in some comments.
	(LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0,
	LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1,
	LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2,
	LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0,
	LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop
	redundant parentheses.
	(I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define.
	(i386_linux_sigcontext_addr): Use it.
	(find_minsym_and_objfile): Change name of second argument.

 
Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.26.2.2
diff -u -p -r1.26.2.2 i386-linux-tdep.c
--- i386-linux-tdep.c 17 May 2003 13:43:30 -0000 1.26.2.2
+++ i386-linux-tdep.c 17 May 2003 15:33:13 -0000
@@ -81,7 +81,7 @@ i386_linux_register_reggroup_p (struct g
 
    The instruction sequence for normal signals is
        pop    %eax
-       mov    $0x77,%eax
+       mov    $0x77, %eax
        int    $0x80
    or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
 
@@ -103,17 +103,17 @@ i386_linux_register_reggroup_p (struct g
    to the ones used by the kernel.  Therefore, these trampolines are
    supported too.  */
 
-#define LINUX_SIGTRAMP_INSN0 (0x58)	/* pop %eax */
-#define LINUX_SIGTRAMP_OFFSET0 (0)
-#define LINUX_SIGTRAMP_INSN1 (0xb8)	/* mov $NNNN,%eax */
-#define LINUX_SIGTRAMP_OFFSET1 (1)
-#define LINUX_SIGTRAMP_INSN2 (0xcd)	/* int */
-#define LINUX_SIGTRAMP_OFFSET2 (6)
+#define LINUX_SIGTRAMP_INSN0	0x58	/* pop %eax */
+#define LINUX_SIGTRAMP_OFFSET0	0
+#define LINUX_SIGTRAMP_INSN1	0xb8	/* mov $NNNN, %eax */
+#define LINUX_SIGTRAMP_OFFSET1	1
+#define LINUX_SIGTRAMP_INSN2	0xcd	/* int */
+#define LINUX_SIGTRAMP_OFFSET2	6
 
 static const unsigned char linux_sigtramp_code[] =
 {
   LINUX_SIGTRAMP_INSN0,					/* pop %eax */
-  LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00,		/* mov $0x77,%eax */
+  LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00,		/* mov $0x77, %eax */
   LINUX_SIGTRAMP_INSN2, 0x80				/* int $0x80 */
 };
 
@@ -167,20 +167,20 @@ i386_linux_sigtramp_start (CORE_ADDR pc)
 
 /* This function does the same for RT signals.  Here the instruction
    sequence is
-       mov    $0xad,%eax
+       mov    $0xad, %eax
        int    $0x80
    or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
 
    The effect is to call the system call rt_sigreturn.  */
 
-#define LINUX_RT_SIGTRAMP_INSN0 (0xb8)	/* mov $NNNN,%eax */
-#define LINUX_RT_SIGTRAMP_OFFSET0 (0)
-#define LINUX_RT_SIGTRAMP_INSN1 (0xcd)	/* int */
-#define LINUX_RT_SIGTRAMP_OFFSET1 (5)
+#define LINUX_RT_SIGTRAMP_INSN0		0xb8 /* mov $NNNN, %eax */
+#define LINUX_RT_SIGTRAMP_OFFSET0	0
+#define LINUX_RT_SIGTRAMP_INSN1		0xcd /* int */
+#define LINUX_RT_SIGTRAMP_OFFSET1	5
 
 static const unsigned char linux_rt_sigtramp_code[] =
 {
-  LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00,	/* mov $0xad,%eax */
+  LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00,	/* mov $0xad, %eax */
   LINUX_RT_SIGTRAMP_INSN1, 0x80				/* int $0x80 */
 };
 
@@ -239,6 +239,9 @@ i386_linux_pc_in_sigtramp (CORE_ADDR pc,
 	  || strcmp ("__restore_rt", name) == 0);
 }
 
+/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>.  */
+#define I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 20
+
 /* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
    routine, return the address of the associated sigcontext structure.  */
 
@@ -269,11 +272,14 @@ i386_linux_sigcontext_addr (struct frame
   pc = i386_linux_rt_sigtramp_start (frame_pc_unwind (next_frame));
   if (pc)
     {
+      CORE_ADDR ucontext_addr;
+
       /* The sigcontext structure is part of the user context.  A
 	 pointer to the user context is passed as the third argument
 	 to the signal handler.  */
       read_memory (sp + 8, 4, buf);
-      return extract_unsigned_integer (buf, 4) + 20;
+      ucontext_addr = extract_unsigned_integer (buf, 4) + 20;
+      return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
     }
 
   error ("Couldn't recognize signal trampoline.");
@@ -313,7 +319,7 @@ i386_linux_write_pc (CORE_ADDR pc, ptid_
    be considered too special-purpose for general consumption.  */
 
 static struct minimal_symbol *
-find_minsym_and_objfile (char *name, struct objfile **objfile_p)
+find_minsym_and_objfile (char *name, struct objfile **objfilep)
 {
   struct objfile *objfile;
 
@@ -326,7 +332,7 @@ find_minsym_and_objfile (char *name, str
 	  if (SYMBOL_LINKAGE_NAME (msym)
 	      && strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
 	    {
-	      *objfile_p = objfile;
+	      *objfilep = objfile;
 	      return msym;
 	    }
 	}
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.138.2.11
diff -u -p -r1.138.2.11 i386-tdep.c
--- i386-tdep.c 17 May 2003 13:43:29 -0000 1.138.2.11
+++ i386-tdep.c 17 May 2003 15:33:13 -0000
@@ -969,7 +969,7 @@ i386_unwind_dummy_id (struct gdbarch *gd
   CORE_ADDR fp;
 
   frame_unwind_register (next_frame, I386_EBP_REGNUM, buf);
-  fp = extract_typed_address (buf, builtin_type_void_data_ptr);
+  fp = extract_unsigned_integer (buf, 4);
 
   return frame_id_build (fp + 8, frame_pc_unwind (next_frame));
 }


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