diff -urp ltrace-0.5-1/process_event.c ltrace-0.5/process_event.c --- ltrace-0.5-1/process_event.c 2008-10-07 12:09:14.000000000 +0200 +++ ltrace-0.5/process_event.c 2008-10-07 12:09:37.000000000 +0200 @@ -228,19 +228,6 @@ static void process_sysret(struct event output_right(LT_TOF_SYSCALLR, event->proc, sysname(event->proc, event->e_un.sysnum)); } - if (exec_p(event->proc, event->e_un.sysnum)) { - pid_t saved_pid; - event->proc->mask_32bit = 0; - event->proc->personality = 0; - /* FIXME: Leak, should have arch_dep_free. - But we are leaking here much more than that. */ - event->proc->arch_ptr = NULL; - event->proc->filename = pid2name(event->proc->pid); - saved_pid = event->proc->pid; - event->proc->pid = 0; - breakpoints_init(event->proc); - event->proc->pid = saved_pid; - } continue_process(event->proc->pid); } Only in ltrace-0.5: process_event.c.orig diff -urp ltrace-0.5-1/wait_for_something.c ltrace-0.5/wait_for_something.c --- ltrace-0.5-1/wait_for_something.c 2008-10-07 12:09:14.000000000 +0200 +++ ltrace-0.5/wait_for_something.c 2008-10-07 12:09:37.000000000 +0200 @@ -110,6 +110,29 @@ struct event *wait_for_something(void) continue_after_signal(event.proc->pid, event.e_un.signum); return &event; } + if (WSTOPSIG(status) == SIGTRAP){ + /* Check whether this SIGTRAP is received just after execve is called for this process */ + struct callstack_element *elem; + elem = &event.proc->callstack[event.proc->callstack_depth - 1]; + if( elem && elem->is_syscall && exec_p(event.proc, elem->c_un.syscall)){ + pid_t saved_pid; + + event.thing = LT_EV_NONE; + event.e_un.signum = WSTOPSIG(status); + debug(1,"Placing breakpoints for the new program"); + event.proc->mask_32bit = 0; + event.proc->personality = 0; + event.proc->arch_ptr = NULL; + event.proc->filename = pid2name(event.proc->pid); + saved_pid = event.proc->pid; + event.proc->pid = 0; + breakpoints_init(event.proc); + event.proc->pid = saved_pid; + continue_process(event.proc->pid); + return &event; + } + } + event.thing = LT_EV_BREAKPOINT; if (!event.proc->instruction_pointer) { event.proc->instruction_pointer = Only in ltrace-0.5: wait_for_something.c.orig