Optimize out dummy PC printing on signal delivery
* strace.c (trace): Optimize out dummy PC printing on signal delivery.
While at it, tweak comments.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/strace.c b/strace.c
index e5973b4..c018abf 100644
--- a/strace.c
+++ b/strace.c
@@ -2493,7 +2493,7 @@
if (tcp->flags & TCB_BPTSET) {
/*
* One example is a breakpoint inherited from
- * parent through fork ().
+ * parent through fork().
*/
if (clearbpt(tcp) < 0) /* Pretty fatal */ {
droptcb(tcp);
@@ -2543,22 +2543,22 @@
# define PSR_RI 41
pc += (psr >> PSR_RI) & 0x3;
# define PC_FORMAT_STR " @ %lx"
-# define PC_FORMAT_ARG pc
+# define PC_FORMAT_ARG , pc
#else
-# define PC_FORMAT_STR "%s"
-# define PC_FORMAT_ARG ""
+# define PC_FORMAT_STR ""
+# define PC_FORMAT_ARG /* nothing */
#endif
printleader(tcp);
if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) == 0) {
tprintf("--- ");
printsiginfo(&si, verbose(tcp));
tprintf(" (%s)" PC_FORMAT_STR " ---",
- strsignal(WSTOPSIG(status)),
+ strsignal(WSTOPSIG(status))
PC_FORMAT_ARG);
} else
tprintf("--- %s by %s" PC_FORMAT_STR " ---",
strsignal(WSTOPSIG(status)),
- signame(WSTOPSIG(status)),
+ signame(WSTOPSIG(status))
PC_FORMAT_ARG);
printtrailer();
}
@@ -2568,9 +2568,15 @@
}
continue;
}
- /* we handled the STATUS, we are permitted to interrupt now. */
+
+ /* We handled quick cases, we are permitted to interrupt now. */
if (interrupted)
return 0;
+
+ /* This should be syscall entry or exit.
+ * (Or it still can be that pesky post-execve SIGTRAP!)
+ * Handle it.
+ */
if (trace_syscall(tcp) < 0 && !tcp->ptrace_errno) {
/* ptrace() failed in trace_syscall() with ESRCH.
* Likely a result of process disappearing mid-flight.