>Why are we using kernel headers to build gdb?  This header should come from
>glibc, and be the same for all Linux ports.

It's included by glibc's <sys/user.h>, which wants struct pt_regs.  You won't 
see the problem with kernel 2.2 because it doesn't define any PT_ constants in 
the <asm/ptrace.h> file -- they're all in <linux/ptrace.h> and ptrace.c, the 
former of which is already explicitly eschewed by user.h for exactly this 
reason.

As well as fixing the kernel I think we should apply a patch like the one 
below to glibc, to avoid any such problems in the future.  (I haven't tested 
this yet, but you get the idea.)

p.

2000-08-01  Philip Blundell  <[EMAIL PROTECTED]>

        * sysdeps/unix/sysv/linux/arm/sys/user.h: Avoid use of kernel
        headers.

Index: sysdeps/unix/sysv/linux/arm/sys/user.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/arm/sys/user.h,v
retrieving revision 1.2
diff -u -p -u -r1.2 user.h
--- user.h      1999/09/14 01:38:51     1.2
+++ user.h      2000/08/01 21:21:36
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000 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
@@ -21,11 +21,6 @@
 
 #include <features.h>
 
-/* <sys/ptrace.h> and <linux/ptrace.h> both define the PTRACE_* macros.
-   This leads to compilation problems with programs which include both
-   user.h and ptrace.h (eg: GDB).  Do not include <linux/ptrace.h> here. */
-#include <asm/ptrace.h>
-
 struct user_fp
 {
   struct fp_reg
@@ -44,9 +39,14 @@ struct user_fp
   unsigned int init_flag;
 };
 
+struct user_regs
+{
+  unsigned long int uregs[18];
+};
+
 struct user
 {
-  struct pt_regs regs;         /* General registers */
+  struct user_regs regs;       /* General registers */
   int u_fpvalid;               /* True if math co-processor being used. */
 
   unsigned long int u_tsize;   /* Text segment size (pages). */



Reply via email to