#define sys_alarm printargs_u
/* printargs_d does the right thing */
+#define sys_exit printargs_d
#define sys_getpgid printargs_d
#define sys_getsid printargs_d
#define sys_nice printargs_d
cflag_t cflag = CFLAG_NONE;
unsigned int followfork = 0;
-unsigned int ptrace_setoptions = PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC;
+unsigned int ptrace_setoptions = PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC
+ | PTRACE_O_TRACEEXIT;
unsigned int xflag = 0;
bool debug_flag = 0;
bool Tflag = 0;
}
}
+static void
+print_event_exit(struct tcb *tcp)
+{
+ if (entering(tcp) || filtered(tcp) || hide_log(tcp)
+ || cflag == CFLAG_ONLY_STATS) {
+ return;
+ }
+
+ if (followfork < 2 && printing_tcp && printing_tcp != tcp
+ && printing_tcp->curcol != 0) {
+ current_tcp = printing_tcp;
+ tprints(" <unfinished ...>\n");
+ fflush(printing_tcp->outf);
+ printing_tcp->curcol = 0;
+ current_tcp = tcp;
+ }
+
+ if ((followfork < 2 && printing_tcp != tcp)
+ || (tcp->flags & TCB_REPRINT)) {
+ tcp->flags &= ~TCB_REPRINT;
+ printleader(tcp);
+ tprintf("<... %s resumed>", tcp->s_ent->sys_name);
+ }
+
+ if (!(tcp->sys_func_rval & RVAL_DECODED)) {
+ /*
+ * The decoder has probably decided to print something
+ * on exiting syscall which is not going to happen.
+ */
+ tprints(" <unfinished ...>");
+ }
+ tprints(") ");
+ tabto();
+ tprints("= ?\n");
+ line_ended();
+}
+
/* Returns true iff the main trace loop has to continue. */
static bool
trace(void)
sig = WSTOPSIG(status);
- if (event != 0) {
- /* Ptrace event */
+ switch (event) {
+ case 0:
+ break;
+ case PTRACE_EVENT_EXIT:
+ print_event_exit(tcp);
+ goto restart_tracee_with_sig_0;
#if USE_SEIZE
- if (event == PTRACE_EVENT_STOP) {
+ case PTRACE_EVENT_STOP:
/*
* PTRACE_INTERRUPT-stop or group-stop.
* PTRACE_INTERRUPT-stop has sig == SIGTRAP here.
stopped = true;
goto show_stopsig;
}
- }
+ /* fall through */
#endif
- goto restart_tracee_with_sig_0;
+ default:
+ goto restart_tracee_with_sig_0;
}
/*