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