aboutsummaryrefslogtreecommitdiffstats
path: root/strace.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-02-14 03:29:48 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-02-14 03:29:48 +0100
commiteec8d5d6b028665a73169fda96e4e873cb8351f0 (patch)
tree4c8b9f325f5dd2f4723dde8a8909b1f7aa992acb /strace.c
parentd22213a3eecdeb3d13cf428bd090fdfb0f2a8d7d (diff)
downloadandroid_external_strace-eec8d5d6b028665a73169fda96e4e873cb8351f0.tar.gz
android_external_strace-eec8d5d6b028665a73169fda96e4e873cb8351f0.tar.bz2
android_external_strace-eec8d5d6b028665a73169fda96e4e873cb8351f0.zip
[X86] Use ptrace(PTRACE_GETREGSET, NT_PRSTATUS) to get registers.
Unlike PTRACE_GETREGS, this new method detects 32-bit processes reliably, without checking segment register values which are undocumented and aren't part of any sort of API. While at it, also fixed x32 detection to use __X32_SYSCALL_BIT, as it should have been from the beginning. * defs.h: Declare os_release and KERNEL_VERSION. * strace.c: Make os_release non-static, remove KERNEL_VERSION define. * syscall.c: New struct i386_user_regs_struct, static union x86_regs_union and struct iovec x86_io. (printcall): Use i386_regs or x86_64_regs depending on x86_io.iov_len. (get_regs): On x86 and kernels 2.6.30+, use PTRACE_GETREGSET, on earlier kernels fall back to old method. (get_scno): [X86] Determine personality based on regset size on scno & __X32_SYSCALL_BIT. (syscall_fixup_on_sysenter): Use i386_regs or x86_64_regs depending on x86_io.iov_len. (get_syscall_args): Likewise. (get_error): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'strace.c')
-rw-r--r--strace.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/strace.c b/strace.c
index eac6ba59..bc98d365 100644
--- a/strace.c
+++ b/strace.c
@@ -58,9 +58,6 @@ extern char *optarg;
# define my_tkill(tid, sig) kill((tid), (sig))
#endif
-#undef KERNEL_VERSION
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-
cflag_t cflag = CFLAG_NONE;
unsigned int followfork = 0;
unsigned int ptrace_setoptions = 0;
@@ -146,7 +143,7 @@ static struct tcb **tcbtab;
static unsigned int nprocs, tcbtabsize;
static const char *progname;
-static unsigned os_release; /* generated from uname()'s u.release */
+unsigned os_release; /* generated from uname()'s u.release */
static int detach(struct tcb *tcp);
static int trace(void);