diff -Naurp ltrace-0.5/process_event.c ltrace-0.5-mod/process_event.c --- ltrace-0.5/process_event.c 2006-09-26 08:41:49.000000000 -0500 +++ ltrace-0.5-mod/process_event.c 2006-09-26 08:41:20.000000000 -0500 @@ -238,19 +238,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); } diff -Naurp ltrace-0.5/wait_for_something.c ltrace-0.5-mod/wait_for_something.c --- ltrace-0.5/wait_for_something.c 2006-02-20 15:48:07.000000000 -0600 +++ ltrace-0.5-mod/wait_for_something.c 2006-09-26 08:41:20.000000000 -0500 @@ -92,6 +92,29 @@ struct event *wait_for_something(void) event.e_un.signum = WSTOPSIG(status); 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 =