summaryrefslogtreecommitdiff
path: root/defs.h
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 /defs.h
parentd22213a3eecdeb3d13cf428bd090fdfb0f2a8d7d (diff)
downloadstrace-eec8d5d6b028665a73169fda96e4e873cb8351f0.tar.gz
strace-eec8d5d6b028665a73169fda96e4e873cb8351f0.tar.bz2
strace-eec8d5d6b028665a73169fda96e4e873cb8351f0.tar.xz
[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 'defs.h')
-rw-r--r--defs.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/defs.h b/defs.h
index ab474cb..8ea1aaa 100644
--- a/defs.h
+++ b/defs.h
@@ -518,10 +518,13 @@ extern bool not_failing_only;
extern bool show_fd_path;
extern bool tracing_paths;
extern bool need_fork_exec_workarounds;
-extern unsigned int xflag;
-extern unsigned int followfork;
-extern unsigned int ptrace_setoptions;
-extern unsigned int max_strlen;
+extern unsigned xflag;
+extern unsigned followfork;
+extern unsigned ptrace_setoptions;
+extern unsigned max_strlen;
+extern unsigned os_release;
+#undef KERNEL_VERSION
+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };