Re: [RFA 4/8] New port: TI C6x: Read loadmap from gdbserver

Mark Kettenis
2011-08-08T14:01:01Z

> Date: Mon, 08 Aug 2011 21:04:51 +0800
> From: Yao Qi <yao@codesourcery.com>
>
> On 08/08/2011 04:28 PM, Mark Kettenis wrote:
> > Now the kernel vs. libc headers issue has always been a contentious
> > one on Linux. But I think you should use the PTRACE_-prefixed names
> > in your code since those are the "official" Linux names, since Linux
> > was intended to be System V compatible. The PT_-prefixed names are
> > really only for compatibility with BSD (So I don't really understand
> > why people keep adding them for ptrace(2) requests that no BSD variant
> > ever had).
>
> Mark, thanks for pointing this out. If we want to use PTRACE_GETDSBT
> here, we should include "asm/ptrace.h" in linux-low.c, which I am
> hesitant to do. Current convention in linux-low.c, AFAICT, is about
> target-independent code, and so "asm/ptrace.h" is not included. I don't
> want to break this convention to include "asm/ptrace.h", but I am not
> insist on this. If you believe it is safe to include "asm/ptrace.h", I
> am fine with it.

Bleah. Assuming your TI C6x system's libc headers are somewhat
similar to my amd64 system I see your problem. The <sys/ptrace.h>
header file uses an enum for the PTRACE_XXX values, and only has
#defines for the PT_XXX values.

I think you have two choices:

1. Add a configure test for PTRACE_GETDSBT.

2. s/PTRACE_/PT_/g everywehere in your diff.

Personally I'd prefer choice #2, since we already have to many
configure checks ;).