and use it.
(proceed, start_remote): Update call to wait_for_inferior.
* inferior.h (wait_for_inferior): Update declaration.
* fork-child.c, infcmd.c, solib-irix.c, solib-osf.c, solib-sunos.c,
solib-svr4.c, win32-nat.c: Update calls to wait_for_inferior.
* inf-ttrace.c (inf_ttrace_wait): Report TTEVT_EXEC events as
TARGET_WAITKIND_EXECD instead of TARGET_WAITKIND_STOPPED.
+2007-12-21 Joel Brobecker <brobecker@adacore.com>
+
+ * infrun.c (wait_for_inferior): Add treat_exec_as_sigtrap parameter
+ and use it.
+ (proceed, start_remote): Update call to wait_for_inferior.
+ * inferior.h (wait_for_inferior): Update declaration.
+ * fork-child.c, infcmd.c, solib-irix.c, solib-osf.c, solib-sunos.c,
+ solib-svr4.c, win32-nat.c: Update calls to wait_for_inferior.
+ * inf-ttrace.c (inf_ttrace_wait): Report TTEVT_EXEC events as
+ TARGET_WAITKIND_EXECD instead of TARGET_WAITKIND_STOPPED.
+
2008-01-29 Aleksandar Ristovski <aristovski@qnx.com>
* varobj (adjust_value_for_child_access): Added checking for
{
/* 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.
#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);
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:
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
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 *);
does not support asynchronous execution. */
if (!target_can_async_p ())
{
- wait_for_inferior ();
+ wait_for_inferior (0);
normal_stop ();
}
}
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,
int stop_info);
/* Wait for control to return from inferior to debugger.
+
+ If TREAT_EXEC_AS_SIGTRAP is non-zero, then handle EXEC signals
+ as if they were SIGTRAP signals. This can be useful during
+ the startup sequence on some targets such as HP/UX, where
+ we receive an EXEC event instead of the expected SIGTRAP.
+
If inferior gets a signal, we may decide to start it up again
instead of returning. That is why there is a loop in this function.
When this function actually returns it means the inferior
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);
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);
do
{
target_resume (pid_to_ptid (-1), 0, stop_signal);
- wait_for_inferior ();
+ wait_for_inferior (0);
}
while (stop_signal != TARGET_SIGNAL_TRAP);
do
{
target_resume (minus_one_ptid, 0, stop_signal);
- wait_for_inferior ();
+ wait_for_inferior (0);
}
while (stop_signal != TARGET_SIGNAL_TRAP);
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;
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;
while (1)
{
stop_after_trap = 1;
- wait_for_inferior ();
+ wait_for_inferior (0);
if (stop_signal != TARGET_SIGNAL_TRAP)
resume (0, stop_signal);
else
while (1)
{
stop_after_trap = 1;
- wait_for_inferior ();
+ wait_for_inferior (0);
if (stop_signal != TARGET_SIGNAL_TRAP)
resume (0, stop_signal);
else