This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: Compile error: 'PTRACE_GETREGS' undeclared (first use in this function) by arm64-sdk


On 2015/11/18 16:21, Arnd Bergmann wrote:
> On Wednesday 18 November 2015 15:10:08 Cui Bixuan wrote:
>> Hi,
>>   I want to use ptrace in arm64, and there is a compile problem:
>>
>> # aarch64-linux-gnu-gcc ptrace.c -o ptrace
>> ptrace.c: In function 'main':
>> ptrace.c:48:29: error: 'PTRACE_GETREGS' undeclared (first use in this function)
>>          ptrace_ret = ptrace(PTRACE_GETREGS, child, NULL, &regs);
>>                              ^
>> If the glibc does not support 'PTRACE_GETREGS'?
>>
>>
>> but I find:
>>
>> /* Get register content.  */
>>   PTRACE_GETREGSET = 0x4204,
>> #define PTRACE_GETREGSET PTRACE_GETREGSET
>>
>> in eglibc-2.19/libc/ports/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h.
>> Then I don't know why 
>>
>>
>> And I know 'regs' in ptrace(PTRACE_GETREGS, child, NULL, &regs) can define:
>> 'struct user regs' in arm or powerpc;
>> 'struct user_fpregs_struct regs' in X86_64 or i386;
>>
>> but I can't find the struct in eglibc-2.19/libc/ports/sysdeps/unix/sysv/linux/aarch64/sys/user.h
>> What should I do in arm64 if I want to use it?
> 
> This is really a kernel question, not glibc. Anyway, on new architectures like
> arm64, you need to use PTRACE_GETREGSET instead of PTRACE_GETREGS.
> 
> To get the normal registers, use REGSET_GPR, which gives you a struct user_pt_regs,
> or use REGSET_FPR, REGSET_TLS, REGSET_HW_BREAK, REGSET_HW_WATCH or REGSET_SYSTEM_CALL
> to get the other registers and related things.
> 
Thanks for you help.

Cui Bixuan
> 	Arnd
> 
> 


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