aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-01-29 21:11:24 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-01-29 21:11:24 +0000
commitae123ec613348e9e00c637c6945bbaab1a26ce42 (patch)
treeb0153aac96928f39d5eb0d87eb590e7b4501b4ac
parent401ea829c8166bb5a1f18ec2a164e8ee4b244fc8 (diff)
downloadgdb-ae123ec613348e9e00c637c6945bbaab1a26ce42.zip
gdb-ae123ec613348e9e00c637c6945bbaab1a26ce42.tar.gz
gdb-ae123ec613348e9e00c637c6945bbaab1a26ce42.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/fork-child.c2
-rw-r--r--gdb/inf-ttrace.c8
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/inferior.h2
-rw-r--r--gdb/infrun.c23
-rw-r--r--gdb/solib-irix.c2
-rw-r--r--gdb/solib-osf.c2
-rw-r--r--gdb/solib-sunos.c2
-rw-r--r--gdb/solib-svr4.c2
-rw-r--r--gdb/win32-nat.c2
-rw-r--r--gdb/windows-nat.c2
12 files changed, 39 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a4daaec..c834a49 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 9f0588e..15b8245 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -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.
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index 4f8b45f..c3a0bb6 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -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:
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index b90fbec..a533459 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -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
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 3d17d74..e78c25e 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -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 *);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 942fb7d..c3d262e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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);
diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
index 1f6ddfc..14f9fc2 100644
--- a/gdb/solib-irix.c
+++ b/gdb/solib-irix.c
@@ -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);
diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c
index cb9215c..02cc4db 100644
--- a/gdb/solib-osf.c
+++ b/gdb/solib-osf.c
@@ -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);
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index f16e9b5..0834d0f 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -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;
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 4c9e82d..8ef400d 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -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;
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index 954a597..48d07e4 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -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
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 954a597..48d07e4 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -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