* 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.
This commit is contained in:
Joel Brobecker 2008-01-29 21:11:24 +00:00
parent 401ea829c8
commit ae123ec613
12 changed files with 39 additions and 21 deletions

View File

@ -1,3 +1,14 @@
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

View File

@ -410,7 +410,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.

View File

@ -896,10 +896,6 @@ inf_ttrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
#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 target_waitstatus *ourstatus)
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:

View File

@ -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

View File

@ -166,7 +166,7 @@ extern CORE_ADDR signed_pointer_to_address (struct type *type,
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 *);

View File

@ -852,7 +852,7 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
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,
@ -989,20 +989,28 @@ static void print_stop_reason (enum inferior_stop_reason stop_reason,
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);
@ -1034,6 +1042,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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -1507,7 +1507,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

View File

@ -1507,7 +1507,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