Don't attempt to use PTRACE_GETREGS if it isn't defined.

Follow up to https://chromium-review.googlesource.com/c/484479/, which
does not compile on arm64.

Bug: chromium:725754
Change-Id: Iaa6fbc332564909a10e2602a1026c14fb25625f4
Reviewed-on: https://chromium-review.googlesource.com/515044
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
John Budorick 2017-05-25 07:02:43 -07:00 committed by Mike Frysinger
parent fbfd41af5f
commit dc3ba60f0f

View file

@ -169,6 +169,7 @@ bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
} }
bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) { bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) {
#ifdef PTRACE_GETREGS
void* gp_addr; void* gp_addr;
info->GetGeneralPurposeRegisters(&gp_addr, NULL); info->GetGeneralPurposeRegisters(&gp_addr, NULL);
if (sys_ptrace(PTRACE_GETREGS, tid, NULL, gp_addr) == -1) { if (sys_ptrace(PTRACE_GETREGS, tid, NULL, gp_addr) == -1) {
@ -185,8 +186,11 @@ bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) {
if (sys_ptrace(PTRACE_GETFPREGS, tid, NULL, fp_addr) == -1) { if (sys_ptrace(PTRACE_GETFPREGS, tid, NULL, fp_addr) == -1) {
return false; return false;
} }
#endif #endif // !(defined(__ANDROID__) && defined(__ARM_EABI__))
return true; return true;
#else // PTRACE_GETREGS
return false;
#endif
} }
// Read thread info from /proc/$pid/status. // Read thread info from /proc/$pid/status.