Index: infrun.c =================================================================== RCS file: /cvs/src/src/gdb/infrun.c,v retrieving revision 1.260 diff -u -p -r1.260 infrun.c --- infrun.c 19 Dec 2007 05:16:35 -0000 1.260 +++ infrun.c 21 Dec 2007 15:12:45 -0000 @@ -852,7 +852,7 @@ proceed (CORE_ADDR addr, enum target_sig does not support asynchronous execution. */ if (!target_can_async_p ()) { - wait_for_inferior (); + wait_for_inferior (0); normal_stop (); } } @@ -882,7 +882,7 @@ start_remote (int from_tty) target_open() return to the caller an indication that the target is currently running and GDB state should be set to the same as for an async run. */ - wait_for_inferior (); + wait_for_inferior (0); /* Now that the inferior has stopped, do any bookkeeping like loading shared libraries. We want to do this before normal_stop, @@ -995,14 +995,16 @@ static void print_stop_reason (enum infe should be left stopped and GDB should read more commands. */ void -wait_for_inferior (void) +wait_for_inferior (int treat_exec_as_sigtrap) { struct cleanup *old_cleanups; struct execution_control_state ecss; struct execution_control_state *ecs; if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, "infrun: wait_for_inferior\n"); + fprintf_unfiltered + (gdb_stdlog, "infrun: wait_for_inferior (treat_exec_as_sigtrap=%d)\n", + treat_exec_as_sigtrap); old_cleanups = make_cleanup (delete_step_resume_breakpoint, &step_resume_breakpoint); @@ -1034,6 +1036,13 @@ wait_for_inferior (void) else ecs->ptid = target_wait (ecs->waiton_ptid, ecs->wp); + if (treat_exec_as_sigtrap && ecs->ws.kind == TARGET_WAITKIND_EXECD) + { + xfree (ecs->ws.value.execd_pathname); + ecs->ws.kind = TARGET_WAITKIND_STOPPED; + ecs->ws.value.sig = TARGET_SIGNAL_TRAP; + } + /* Now figure out what to do with the result of the result. */ handle_inferior_event (ecs); Index: inferior.h =================================================================== RCS file: /cvs/src/src/gdb/inferior.h,v retrieving revision 1.85 diff -u -p -r1.85 inferior.h --- inferior.h 23 Aug 2007 18:08:35 -0000 1.85 +++ inferior.h 21 Dec 2007 15:02:58 -0000 @@ -166,7 +166,7 @@ extern CORE_ADDR signed_pointer_to_addre extern void address_to_signed_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr); -extern void wait_for_inferior (void); +extern void wait_for_inferior (int treat_exec_as_sigtrap); extern void fetch_inferior_event (void *); Index: fork-child.c =================================================================== RCS file: /cvs/src/src/gdb/fork-child.c,v retrieving revision 1.35 diff -u -p -r1.35 fork-child.c --- fork-child.c 23 Aug 2007 18:08:31 -0000 1.35 +++ fork-child.c 21 Dec 2007 15:02:40 -0000 @@ -419,7 +419,7 @@ startup_inferior (int ntraps) { /* Make wait_for_inferior be quiet. */ stop_soon = STOP_QUIETLY; - wait_for_inferior (); + wait_for_inferior (1); if (stop_signal != TARGET_SIGNAL_TRAP) { /* Let shell child handle its own signals in its own way. Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.164 diff -u -p -r1.164 infcmd.c --- infcmd.c 15 Nov 2007 06:24:17 -0000 1.164 +++ infcmd.c 21 Dec 2007 15:02:58 -0000 @@ -1908,7 +1908,7 @@ attach_command (char *args, int from_tty way for handle_inferior_event to reset the stop_signal variable after an attach, and this is what STOP_QUIETLY_NO_SIGSTOP is for. */ stop_soon = STOP_QUIETLY_NO_SIGSTOP; - wait_for_inferior (); + wait_for_inferior (0); stop_soon = NO_STOP_QUIETLY; #endif Index: solib-irix.c =================================================================== RCS file: /cvs/src/src/gdb/solib-irix.c,v retrieving revision 1.16 diff -u -p -r1.16 solib-irix.c --- solib-irix.c 24 Oct 2007 21:15:35 -0000 1.16 +++ solib-irix.c 21 Dec 2007 15:03:38 -0000 @@ -438,7 +438,7 @@ irix_solib_create_inferior_hook (void) do { target_resume (pid_to_ptid (-1), 0, stop_signal); - wait_for_inferior (); + wait_for_inferior (0); } while (stop_signal != TARGET_SIGNAL_TRAP); Index: solib-osf.c =================================================================== RCS file: /cvs/src/src/gdb/solib-osf.c,v retrieving revision 1.12 diff -u -p -r1.12 solib-osf.c --- solib-osf.c 22 Sep 2007 19:33:31 -0000 1.12 +++ solib-osf.c 21 Dec 2007 15:03:39 -0000 @@ -324,7 +324,7 @@ osf_solib_create_inferior_hook (void) do { target_resume (minus_one_ptid, 0, stop_signal); - wait_for_inferior (); + wait_for_inferior (0); } while (stop_signal != TARGET_SIGNAL_TRAP); Index: solib-sunos.c =================================================================== RCS file: /cvs/src/src/gdb/solib-sunos.c,v retrieving revision 1.25 diff -u -p -r1.25 solib-sunos.c --- solib-sunos.c 23 Aug 2007 18:08:38 -0000 1.25 +++ solib-sunos.c 21 Dec 2007 15:03:40 -0000 @@ -765,7 +765,7 @@ sunos_solib_create_inferior_hook (void) do { target_resume (pid_to_ptid (-1), 0, stop_signal); - wait_for_inferior (); + wait_for_inferior (0); } while (stop_signal != TARGET_SIGNAL_TRAP); stop_soon = NO_STOP_QUIETLY; Index: solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.79 diff -u -p -r1.79 solib-svr4.c --- solib-svr4.c 24 Oct 2007 21:22:08 -0000 1.79 +++ solib-svr4.c 21 Dec 2007 15:03:40 -0000 @@ -1364,7 +1364,7 @@ svr4_solib_create_inferior_hook (void) do { target_resume (pid_to_ptid (-1), 0, stop_signal); - wait_for_inferior (); + wait_for_inferior (0); } while (stop_signal != TARGET_SIGNAL_TRAP); stop_soon = NO_STOP_QUIETLY; Index: win32-nat.c =================================================================== RCS file: /cvs/src/src/gdb/win32-nat.c,v retrieving revision 1.143 diff -u -p -r1.143 win32-nat.c --- win32-nat.c 6 Dec 2007 11:17:03 -0000 1.143 +++ win32-nat.c 21 Dec 2007 15:04:02 -0000 @@ -1517,7 +1517,7 @@ do_initial_win32_stuff (DWORD pid) while (1) { stop_after_trap = 1; - wait_for_inferior (); + wait_for_inferior (0); if (stop_signal != TARGET_SIGNAL_TRAP) resume (0, stop_signal); else Index: inf-ttrace.c =================================================================== RCS file: /cvs/src/src/gdb/inf-ttrace.c,v retrieving revision 1.24 diff -u -p -r1.24 inf-ttrace.c --- inf-ttrace.c 18 Sep 2007 12:42:22 -0000 1.24 +++ inf-ttrace.c 21 Dec 2007 15:12:45 -0000 @@ -896,10 +896,6 @@ inf_ttrace_wait (ptid_t ptid, struct tar #endif case TTEVT_EXEC: - /* FIXME: kettenis/20051029: GDB doesn't really know how to deal - with TARGET_WAITKIND_EXECD events yet. So we make it look - like a SIGTRAP instead. */ -#if 0 ourstatus->kind = TARGET_WAITKIND_EXECD; ourstatus->value.execd_pathname = xmalloc (tts.tts_u.tts_exec.tts_pathlen + 1); @@ -908,10 +904,6 @@ inf_ttrace_wait (ptid_t ptid, struct tar tts.tts_u.tts_exec.tts_pathlen, 0) == -1) perror_with_name (("ttrace")); ourstatus->value.execd_pathname[tts.tts_u.tts_exec.tts_pathlen] = 0; -#else - ourstatus->kind = TARGET_WAITKIND_STOPPED; - ourstatus->value.sig = TARGET_SIGNAL_TRAP; -#endif break; case TTEVT_EXIT: