* didn't finish ("SIGKILL nuked us after syscall entry" etc).
*/
tprints(" <unfinished ...>\n");
- printing_tcp->flags |= TCB_REPRINT;
printing_tcp->curcol = 0;
}
}
tcp = execve_thread;
if (tcp) {
tcp->pid = pid;
- tcp->flags |= TCB_REPRINT;
- if (!cflag) {
+ if (cflag != CFLAG_ONLY_STATS) {
printleader(tcp);
tprintf("+++ superseded by execve in pid %lu +++\n", old_pid);
line_ended();
+ tcp->flags |= TCB_REPRINT;
}
}
}
/* Nonzero (true) if tracee is stopped by signal
* (as opposed to "tracee received signal").
+ * TODO: shouldn't we check for errno == EINVAL too?
+ * We can get ESRCH instead, you know...
*/
stopped = (ptrace(PTRACE_GETSIGINFO, pid, 0, (long) &si) < 0);
#ifdef USE_SEIZE
if (res != 1) {
printleader(tcp);
- tcp->flags &= ~TCB_REPRINT;
if (scno_good != 1)
tprints("????" /* anti-trigraph gap */ "(");
else if (!SCNO_IN_RANGE(tcp->scno))
}
printleader(tcp);
- tcp->flags &= ~TCB_REPRINT;
if (!SCNO_IN_RANGE(tcp->scno))
tprintf("syscall_%lu(", tcp->scno);
else
}
}
- /* TODO: TCB_REPRINT is probably not necessary:
- * we can determine whether reprinting is needed
- * by examining printing_tcp. Something like:
- * if not in -ff mode, and printing_tcp != tcp,
- * then the log is not currently ends with *our*
- * syscall entry output, but with something else,
- * and we need to reprint.
- * If we'd implement this, printing_tcp = tcp
- * assignments in code below can be made more logical.
- */
-
- if (tcp->flags & TCB_REPRINT) {
- printleader(tcp);
- if (!SCNO_IN_RANGE(tcp->scno))
- tprintf("<... syscall_%lu resumed> ", tcp->scno);
- else
- tprintf("<... %s resumed> ", sysent[tcp->scno].sys_name);
- }
-
if (cflag) {
struct timeval t = tv;
count_syscall(tcp, &t);
}
}
+ /* If not in -ff mode, and printing_tcp != tcp,
+ * then the log currently does not end with output
+ * of _our syscall entry_, but with something else.
+ * We need to say which syscall's return is this.
+ *
+ * Forced reprinting via TCB_REPRINT is used only by
+ * "strace -ff -oLOG test/threaded_execve" corner case.
+ * It's the only case when -ff mode needs reprinting.
+ */
+ if ((followfork < 2 && printing_tcp != tcp) || (tcp->flags & TCB_REPRINT)) {
+ tcp->flags &= ~TCB_REPRINT;
+ printleader(tcp);
+ if (!SCNO_IN_RANGE(tcp->scno))
+ tprintf("<... syscall_%lu resumed> ", tcp->scno);
+ else
+ tprintf("<... %s resumed> ", sysent[tcp->scno].sys_name);
+ }
+ printing_tcp = tcp;
+
if (res != 1) {
- printing_tcp = tcp;
+ /* There was error in one of prior ptrace ops */
tprints(") ");
tabto();
tprints("= ? <unavailable>\n");
return res;
}
+ sys_res = 0;
if (!SCNO_IN_RANGE(tcp->scno)
|| (qual_flags[tcp->scno] & QUAL_RAW)) {
- printing_tcp = tcp;
- sys_res = printargs(tcp);
+ /* sys_res = printargs(tcp); - but it's nop on sysexit */
} else {
/* FIXME: not_failing_only (IOW, option -z) is broken:
* failure of syscall is known only after syscall return.
*/
if (not_failing_only && tcp->u_error)
goto ret; /* ignore failed syscalls */
- printing_tcp = tcp;
sys_res = (*sysent[tcp->scno].sys_func)(tcp);
}