regression tests: more ptrace adjustments for arm64 upstream changes

Merge from trunk commit 3201

In the commit "Rev 3169: regression tests: have
ptrace use PTRACE_GETREGSET by default", I created
some ifdef magic to use the per arch general purpose
register data structures for various architectures,
including arm64.  Unfortunately, in the upstream glibc commit
7d05a8168b
<bits/ptrace.h> is no longer included in the arm64 specific user.h,
which defined the structure as 'struct user_pt_regs'; instead user.h
was converted to define 'struct user_regs_struct'. Because of this,
the ptrace test fails to compile on arm64 when glibc is 2.20 or newer.

This patch adjusts the ptrace test to use the newer structure on arm64
if it's detected that a newer glibc is detected and reverts to using
the older one for older glibcs. It also adds an error when compiling
on architectures that haven't been incorporated yet.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Steve Beattie 2015-07-14 10:58:05 -07:00
parent 6ae4a3c2f0
commit dccd5a18cb

View file

@ -40,9 +40,15 @@ int interp_status(int status)
# if defined(__x86_64__) || defined(__i386__)
# define ARCH_REGS_STRUCT struct user_regs_struct
# elif defined(__aarch64__)
# define ARCH_REGS_STRUCT struct user_pt_regs
# if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 20))
# define ARCH_REGS_STRUCT struct user_regs_struct
# else
# define ARCH_REGS_STRUCT struct user_pt_regs
# endif
# elif defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)
# define ARCH_REGS_STRUCT struct pt_regs
# else
# error "Need to define ARCH_REGS_STRUCT for this architecture"
# endif
int read_ptrace_registers(pid_t pid)