[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [drepper@cygnus.com] glibc-2.0.97



>I got an error in sysdeps/unix/sysv/linux/arm/register-dump.h:
>the registers fields in struct sigcontext (arm_r0..arm_cpsr)
>are not defined.

Can you try the appended patch?  I don't have the 2.0 kernel sources to hand 
so I'm not sure I've got it right.

p.

1998-10-08  Philip Blundell  <pb@nexus.co.uk>

	* sysdeps/unix/sysv/linux/arm/profil-counter.h: Move definition of
	sigcontext union to ...
	* sysdeps/unix/sysv/linux/arm/bits/armsigctx.h: ... here.  New
	file.
	* sysdeps/unix/sysv/linux/arm/register-dump.h: Try to support
	version 2.0 kernels.

diff -u --recursive --new-file --exclude CVS libc-neos/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h libc/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
--- libc-neos/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h	Thu Jan  1 01:00:00 1970
+++ libc/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h	Thu Oct  8 16:46:59 1998
@@ -0,0 +1,59 @@
+/* Definition of `struct sigcontext' for Linux/ARM
+   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* The format of struct sigcontext changed between 2.0 and 2.1 kernels.
+   Fortunately 2.0 puts a magic number in the first word and this is not
+   a legal value for `trap_no', so we can tell them apart.  */
+
+union k_sigcontext
+  {
+    struct
+      {
+	unsigned long int trap_no;
+	unsigned long int error_code;
+	unsigned long int oldmask;
+	unsigned long int arm_r0;
+	unsigned long int arm_r1;
+	unsigned long int arm_r2;
+	unsigned long int arm_r3;
+	unsigned long int arm_r4;
+	unsigned long int arm_r5;
+	unsigned long int arm_r6;
+	unsigned long int arm_r7;
+	unsigned long int arm_r8;
+	unsigned long int arm_r9;
+	unsigned long int arm_r10;
+	unsigned long int arm_fp;
+	unsigned long int arm_ip;
+	unsigned long int arm_sp;
+	unsigned long int arm_lr;
+	unsigned long int arm_pc;
+	unsigned long int arm_cpsr;
+      } v21;
+    struct
+      {
+	unsigned long int magic;
+	struct pt_regs reg;
+	unsigned long int trap_no;
+	unsigned long int error_code;
+	unsigned long int oldmask;
+      } v20;
+};
+
+#define SIGCONTEXT_2_0_MAGIC	0x4B534154
diff -u --recursive --new-file --exclude CVS libc-neos/sysdeps/unix/sysv/linux/arm/profil-counter.h libc/sysdeps/unix/sysv/linux/arm/profil-counter.h
--- libc-neos/sysdeps/unix/sysv/linux/arm/profil-counter.h	Thu Apr  9 10:59:58 1998
+++ libc/sysdeps/unix/sysv/linux/arm/profil-counter.h	Thu Oct  8 16:46:48 1998
@@ -19,51 +19,13 @@
 
 #include <signal.h>
 #include <asm/ptrace.h>
-
-union k_sigcontext
-  {
-    struct
-      {
-	unsigned long int trap_no;
-	unsigned long int error_code;
-	unsigned long int oldmask;
-	unsigned long int arm_r0;
-	unsigned long int arm_r1;
-	unsigned long int arm_r2;
-	unsigned long int arm_r3;
-	unsigned long int arm_r4;
-	unsigned long int arm_r5;
-	unsigned long int arm_r6;
-	unsigned long int arm_r7;
-	unsigned long int arm_r8;
-	unsigned long int arm_r9;
-	unsigned long int arm_r10;
-	unsigned long int arm_fp;
-	unsigned long int arm_ip;
-	unsigned long int arm_sp;
-	unsigned long int arm_lr;
-	unsigned long int arm_pc;
-	unsigned long int arm_cpsr;
-      } v21;
-    struct
-      {
-	unsigned long int magic;
-	struct pt_regs reg;
-	unsigned long int trap_no;
-	unsigned long int error_code;
-	unsigned long int oldmask;
-      } v20;
-};
+#include <bits/armsigctx.h>
 
 void
 profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc)
 {
-  /* The format of struct sigcontext changed between 2.0 and 2.1 kernels.
-     Fortunately 2.0 puts a magic number in the first word and this is not
-     a legal value for `trap_no', so we can tell them apart.  */
-
   void *pc;
-  if (sc.v20.magic == 0x4B534154)
+  if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC)
     pc = (void *) sc.v20.reg.ARM_pc;
   else
     pc = (void *) sc.v21.arm_pc;
diff -u --recursive --new-file --exclude CVS libc-neos/sysdeps/unix/sysv/linux/arm/register-dump.h libc/sysdeps/unix/sysv/linux/arm/register-dump.h
--- libc-neos/sysdeps/unix/sysv/linux/arm/register-dump.h	Thu Oct  1 14:05:38 1998
+++ libc/sysdeps/unix/sysv/linux/arm/register-dump.h	Thu Oct  8 16:52:23 1998
@@ -20,6 +20,7 @@
 
 #include <sys/uio.h>
 #include <stdio-common/_itoa.h>
+#include <bits/armsigctx.h>
 
 /* We will print the register dump in this format:
 
@@ -43,7 +44,7 @@
 }
 
 static void
-register_dump (int fd, struct sigcontext *ctx)
+register_dump (int fd, union k_sigcontext *ctx)
 {
   char regs[20][8];
   struct iovec iov[97];
@@ -59,26 +60,52 @@
   ++nr
 
   /* Generate strings of register contents.  */
-  hexvalue (ctx->arm_r0, regs[0], 8);
-  hexvalue (ctx->arm_r1, regs[1], 8);
-  hexvalue (ctx->arm_r2, regs[2], 8);
-  hexvalue (ctx->arm_r3, regs[3], 8);
-  hexvalue (ctx->arm_r4, regs[4], 8);
-  hexvalue (ctx->arm_r5, regs[5], 8);
-  hexvalue (ctx->arm_r6, regs[6], 8);
-  hexvalue (ctx->arm_r7, regs[7], 8);
-  hexvalue (ctx->arm_r8, regs[8], 8);
-  hexvalue (ctx->arm_r9, regs[9], 8);
-  hexvalue (ctx->arm_r10, regs[10], 4);
-  hexvalue (ctx->arm_fp, regs[11], 4);
-  hexvalue (ctx->arm_ip, regs[12], 4);
-  hexvalue (ctx->arm_sp, regs[13], 4);
-  hexvalue (ctx->arm_lr, regs[14], 4);
-  hexvalue (ctx->arm_pc, regs[15], 4);
-  hexvalue (ctx->arm_cpsr, regs[16], 8);
-  hexvalue (ctx->trap_no, regs[17], 8);
-  hexvalue (ctx->error_code, regs[18], 8);
-  hexvalue (ctx->old_mask, regs[19], 8);
+  if (ctx->v20.magic == SIGCONTEXT_2_0_MAGIC)
+    {
+      hexvalue (ctx->reg.ARM_r0, regs[0], 8);
+      hexvalue (ctx->reg.ARM_r1, regs[1], 8);
+      hexvalue (ctx->reg.ARM_r2, regs[2], 8);
+      hexvalue (ctx->reg.ARM_r3, regs[3], 8);
+      hexvalue (ctx->reg.ARM_r4, regs[4], 8);
+      hexvalue (ctx->reg.ARM_r5, regs[5], 8);
+      hexvalue (ctx->reg.ARM_r6, regs[6], 8);
+      hexvalue (ctx->reg.ARM_r7, regs[7], 8);
+      hexvalue (ctx->reg.ARM_r8, regs[8], 8);
+      hexvalue (ctx->reg.ARM_r9, regs[9], 8);
+      hexvalue (ctx->reg.ARM_r10, regs[10], 4);
+      hexvalue (ctx->reg.ARM_fp, regs[11], 4);
+      hexvalue (ctx->reg.ARM_ip, regs[12], 4);
+      hexvalue (ctx->reg.ARM_sp, regs[13], 4);
+      hexvalue (ctx->reg.ARM_lr, regs[14], 4);
+      hexvalue (ctx->reg.ARM_pc, regs[15], 4);
+      hexvalue (ctx->reg.ARM_cpsr, regs[16], 8);
+      hexvalue (ctx->trap_no, regs[17], 8);
+      hexvalue (ctx->error_code, regs[18], 8);
+      hexvalue (ctx->old_mask, regs[19], 8);
+    }
+  else
+    {
+      hexvalue (ctx->arm_r0, regs[0], 8);
+      hexvalue (ctx->arm_r1, regs[1], 8);
+      hexvalue (ctx->arm_r2, regs[2], 8);
+      hexvalue (ctx->arm_r3, regs[3], 8);
+      hexvalue (ctx->arm_r4, regs[4], 8);
+      hexvalue (ctx->arm_r5, regs[5], 8);
+      hexvalue (ctx->arm_r6, regs[6], 8);
+      hexvalue (ctx->arm_r7, regs[7], 8);
+      hexvalue (ctx->arm_r8, regs[8], 8);
+      hexvalue (ctx->arm_r9, regs[9], 8);
+      hexvalue (ctx->arm_r10, regs[10], 4);
+      hexvalue (ctx->arm_fp, regs[11], 4);
+      hexvalue (ctx->arm_ip, regs[12], 4);
+      hexvalue (ctx->arm_sp, regs[13], 4);
+      hexvalue (ctx->arm_lr, regs[14], 4);
+      hexvalue (ctx->arm_pc, regs[15], 4);
+      hexvalue (ctx->arm_cpsr, regs[16], 8);
+      hexvalue (ctx->trap_no, regs[17], 8);
+      hexvalue (ctx->error_code, regs[18], 8);
+      hexvalue (ctx->old_mask, regs[19], 8);
+    }
 
   /* Generate the output.  */
   ADD_STRING ("Register dump:\n\n R0: ");




Reply to: