Re: [PATCH v3] gdbserver: uclinux: pull in ptrace offset definitions from asm/ptrace.h

Mike Frysinger
2012-04-26T19:04:46Z

[-- Attachment #1: Type: Text/Plain, Size: 3880 bytes --]

On Thursday 26 April 2012 14:48:13 Pedro Alves wrote:
> On 04/26/2012 07:33 PM, Will Deacon wrote:
> > On Thu, Apr 26, 2012 at 07:31:05PM +0100, Pedro Alves wrote:
> >> On 04/26/2012 07:27 PM, Mike Frysinger wrote:
> >>> On Thursday 26 April 2012 14:14:59 Pedro Alves wrote:
> >>>> On 04/26/2012 07:12 PM, Mike Frysinger wrote:
> >>>>> On Thursday 26 April 2012 14:03:00 Will Deacon wrote:
> >>>>>>> +/* PTRACE_TEXT_ADDR and friends. */
> >>>>>>> +#include <asm/ptrace.h>
> >>>>>
> >>>>> check for asm/ptrace.h in configure.ac and then just depend on
> >>>>> HAVE_ASM_PTRACE_H ? although this is fine too since uClibc is
> >>>>> realistically the only C library being used with no-mmu Linux
> >>>>> systems.
> >>>>
> >>>> Was there a time Linux didn't have this header? When we include it
> >>>> GDB, we include it unconditionally (though we don't include it in all
> >>>> ports), and in current mainline, it seems that all 27 ports under
> >>>> arch/ have it.
> >>>
> >>> it's not so much a matter of whether it's provided, but whether it can
> >>> be safely included. ia64 has a history of being a pita to include
> >>> their ptrace headers, but maybe that doesn't matter to gdbserver.
> >>
> >> There are ia64 boxes on the gcc compile farm. Let me give that a try.
> >
> > The ordering of includes probably also comes into play here. I guess we
> > want:
> >
> > <asm/ptrace.h>
> > <sys/ptrace.h>
> > "linux-ptrace.h"
> >
> > and then we hope they all play nicely together with their own namespaces.
>
> Bah, they don't... Before sys/ptrace.h.
>
> gcc -c -g3 -O0 -I. -I../../../src/gdb/gdbserver
> -I../../../src/gdb/gdbserver/../common
> -I../../../src/gdb/gdbserver/../regformats
> -I../../../src/gdb/gdbserver/../../include -Wall
> -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
> -Wno-char-subscripts -Werror ../../../src/gdb/gdbserver/linux-low.c In
> file included from /usr/include/asm/ptrace.h:58,
> from ../../../src/gdb/gdbserver/linux-low.c:27:
> /usr/include/asm/fpu.h:57: error: redefinition of ‘struct ia64_fpreg’
> In file included from ../../../src/gdb/gdbserver/linux-low.c:28:
> /usr/include/sys/ptrace.h:75: error: expected identifier before numeric
> constant /usr/include/sys/ptrace.h:117: error: redefinition of ‘struct
> pt_all_user_regs’ ../../../src/gdb/gdbserver/linux-low.c: In function
> ‘linux_attach_lwp_1’: ../../../src/gdb/gdbserver/linux-low.c:669: error:
> ‘PTRACE_ATTACH’ undeclared (first use in this function)
> ../../../src/gdb/gdbserver/linux-low.c:669: error: (Each undeclared
> identifier is reported only once
> ../../../src/gdb/gdbserver/linux-low.c:669: error: for each function it
> appears in.) ../../../src/gdb/gdbserver/linux-low.c: In function
> ‘linux_detach_one_lwp’: ../../../src/gdb/gdbserver/linux-low.c:1139:
> error: ‘PTRACE_DETACH’ undeclared (first use in this function) make: ***
> [linux-low.o] Error 1
>
> After sys/ptrace.h.
>
> gcc -c -g3 -O0 -I. -I../../../src/gdb/gdbserver
> -I../../../src/gdb/gdbserver/../common
> -I../../../src/gdb/gdbserver/../regformats
> -I../../../src/gdb/gdbserver/../../include -Wall
> -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral
> -Wno-char-subscripts -Werror ../../../src/gdb/gdbserver/linux-low.c In
> file included from /usr/include/asm/ptrace.h:58,
> from ../../../src/gdb/gdbserver/linux-low.c:28:
> /usr/include/asm/fpu.h:57: error: redefinition of ‘struct ia64_fpreg’
> In file included from ../../../src/gdb/gdbserver/linux-low.c:28:
> /usr/include/asm/ptrace.h:208: error: redefinition of ‘struct
> pt_all_user_regs’ make: *** [linux-low.o] Error 1

yes, now you see the pain that ia64 inflicts upon thee!

seems ia64-linux-nat.c skips asm/ptrace.h and goes just for asm/ptrace-
offsets.h
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]