Instead of handling stacktrace capturing and mmap cache invalidating at sys_* functions, handle them at unified place `trace_syscall_entering'. For handling them the makers(SI and SE) introduced at previous patches are referred.
The patch is simpler than its older version(v3). The value of `hide_log_until_execve' is just ignored. I found the value is nothing to do with this patch. `unwind_cache_invalidate' is mentioned only once at `trace_syscall_exiting'. Both are suggested by Dmitry V. Levin <[email protected]>. Signed-off-by: Masatake YAMATO <[email protected]> --- mem.c | 27 --------------------------- process.c | 13 ------------- syscall.c | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/mem.c b/mem.c index 1c36360..267773c 100644 --- a/mem.c +++ b/mem.c @@ -178,13 +178,6 @@ static int print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset) { if (entering(tcp)) { -#ifdef USE_LIBUNWIND - if (stack_trace_enabled) { - unwind_capture_stacktrace(tcp); - unwind_cache_invalidate(tcp); - } -#endif - /* addr */ if (!u_arg[0]) tprints("NULL, "); @@ -313,17 +306,7 @@ sys_munmap(struct tcb *tcp) if (entering(tcp)) { tprintf("%#lx, %lu", tcp->u_arg[0], tcp->u_arg[1]); -#ifdef USE_LIBUNWIND - if (stack_trace_enabled) - unwind_capture_stacktrace(tcp); -#endif - } -#ifdef USE_LIBUNWIND - else { - if (stack_trace_enabled) - unwind_cache_invalidate(tcp); } -#endif return 0; } @@ -334,17 +317,7 @@ sys_mprotect(struct tcb *tcp) tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); printflags(mmap_prot, tcp->u_arg[2], "PROT_???"); -#ifdef USE_LIBUNWIND - if (stack_trace_enabled) - unwind_capture_stacktrace(tcp); -#endif } -#ifdef USE_LIBUNWIND - else { - if (stack_trace_enabled) - unwind_cache_invalidate(tcp); - } -#endif return 0; } diff --git a/process.c b/process.c index 40cc263..e3837da 100644 --- a/process.c +++ b/process.c @@ -989,20 +989,7 @@ sys_execve(struct tcb *tcp) printargv(tcp, tcp->u_arg[2]); tprints("]"); } -#ifdef USE_LIBUNWIND - if (stack_trace_enabled) { - unwind_capture_stacktrace(tcp); - } -#endif } -#ifdef USE_LIBUNWIND - else { - if (stack_trace_enabled) { - unwind_cache_invalidate(tcp); - } - } -#endif - return 0; } diff --git a/syscall.c b/syscall.c index 45714bf..4f2d290 100644 --- a/syscall.c +++ b/syscall.c @@ -2040,6 +2040,13 @@ trace_syscall_entering(struct tcb *tcp) goto ret; } +#ifdef USE_LIBUNWIND + if (stack_trace_enabled) { + if (tcp->s_ent->sys_flags & STACKTRACE_CAPTURE_ON_ENTER) + unwind_capture_stacktrace(tcp); + } +#endif + printleader(tcp); if (tcp->qual_flg & UNDEFINED_SCNO) tprintf("%s(", undefined_scno_name(tcp)); @@ -2513,6 +2520,13 @@ trace_syscall_exiting(struct tcb *tcp) if (Tflag || cflag) gettimeofday(&tv, NULL); +#ifdef USE_LIBUNWIND + if (stack_trace_enabled) { + if (tcp->s_ent->sys_flags & STACKTRACE_INVALIDATE_CACHE) + unwind_cache_invalidate(tcp); + } +#endif + #if SUPPORTED_PERSONALITIES > 1 update_personality(tcp, tcp->currpers); #endif -- 1.9.0 ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
