aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-11 16:09:33 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-11 16:09:33 +0000
commit3c35e65b000b530bf71bb4e283e237134d97c5ec (patch)
tree61f1d84c0d506be6106925f548fda85ed461eea0
parent180b9a0ebe21aa66c83f64f2be28e045abaf14cf (diff)
downloadgdb-3c35e65b000b530bf71bb4e283e237134d97c5ec.zip
gdb-3c35e65b000b530bf71bb4e283e237134d97c5ec.tar.gz
gdb-3c35e65b000b530bf71bb4e283e237134d97c5ec.tar.bz2
* fork-child.c (startup_inferior): Use target_wait and target_resume
directly instead of calling wait_for_inferior / resume. * infcmd.c (kill_if_already_running): Do not call no_shared_libraries or init_wait_for_inferior. (run_command_1): Call init_wait_for_inferior.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/fork-child.c75
-rw-r--r--gdb/infcmd.c4
3 files changed, 70 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4dec4ac..2b44bfb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
+ * fork-child.c (startup_inferior): Use target_wait and target_resume
+ directly instead of calling wait_for_inferior / resume.
+
+ * infcmd.c (kill_if_already_running): Do not call no_shared_libraries
+ or init_wait_for_inferior.
+ (run_command_1): Call init_wait_for_inferior.
+
+2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
+
* gdbtypes.h (builtin_type_void_data_ptr, builtin_type_void_func_ptr,
builtin_type_CORE_ADDR, builtin_type_char, builtin_type_short,
builtin_type_int, builtin_type_long, builtin_type_signed_char,
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 269dd43..d850792 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -428,24 +428,67 @@ startup_inferior (int ntraps)
if (exec_wrapper)
pending_execs++;
- clear_proceed_status ();
-
- init_wait_for_inferior ();
-
while (1)
{
- struct thread_info *tp;
+ int resume_signal = TARGET_SIGNAL_0;
+ ptid_t resume_ptid;
+
+ struct target_waitstatus ws;
+ memset (&ws, 0, sizeof (ws));
+ resume_ptid = target_wait (pid_to_ptid (-1), &ws);
+
+ /* Mark all threads non-executing. */
+ set_executing (pid_to_ptid (-1), 0);
+
+ /* In all-stop mode, resume all threads. */
+ if (!non_stop)
+ resume_ptid = pid_to_ptid (-1);
+
+ switch (ws.kind)
+ {
+ case TARGET_WAITKIND_IGNORE:
+ case TARGET_WAITKIND_SPURIOUS:
+ case TARGET_WAITKIND_LOADED:
+ case TARGET_WAITKIND_FORKED:
+ case TARGET_WAITKIND_VFORKED:
+ case TARGET_WAITKIND_SYSCALL_ENTRY:
+ case TARGET_WAITKIND_SYSCALL_RETURN:
+ /* Ignore gracefully during startup of the inferior. */
+ break;
+
+ case TARGET_WAITKIND_SIGNALLED:
+ target_terminal_ours ();
+ target_mourn_inferior ();
+ error (_("During startup program terminated with signal %s, %s."),
+ target_signal_to_name (ws.value.sig),
+ target_signal_to_string (ws.value.sig));
+ return;
+
+ case TARGET_WAITKIND_EXITED:
+ target_terminal_ours ();
+ target_mourn_inferior ();
+ if (ws.value.integer)
+ error (_("During startup program exited with code %d."),
+ ws.value.integer);
+ else
+ error (_("During startup program exited normally."));
+ return;
+
+ case TARGET_WAITKIND_EXECD:
+ /* Handle EXEC signals as if they were SIGTRAP signals. */
+ xfree (ws.value.execd_pathname);
+ resume_signal = TARGET_SIGNAL_TRAP;
+ break;
+
+ case TARGET_WAITKIND_STOPPED:
+ resume_signal = ws.value.sig;
+ break;
+ }
- /* Make wait_for_inferior be quiet. */
- stop_soon = STOP_QUIETLY;
- wait_for_inferior (1);
- tp = inferior_thread ();
- if (tp->stop_signal != TARGET_SIGNAL_TRAP)
+ if (resume_signal != TARGET_SIGNAL_TRAP)
{
- /* Let shell child handle its own signals in its own way.
- FIXME: what if child has exited? Must exit loop
- somehow. */
- resume (0, tp->stop_signal);
+ /* Let shell child handle its own signals in its own way. */
+ target_resume (resume_ptid, 0, resume_signal);
}
else
{
@@ -470,10 +513,10 @@ startup_inferior (int ntraps)
if (--pending_execs == 0)
break;
- resume (0, TARGET_SIGNAL_0); /* Just make it go on. */
+ /* Just make it go on. */
+ target_resume (resume_ptid, 0, TARGET_SIGNAL_0);
}
}
- stop_soon = NO_STOP_QUIETLY;
}
/* Implement the "unset exec-wrapper" command. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ca11aa5..6ffc97f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -431,8 +431,6 @@ kill_if_already_running (int from_tty)
Start it from the beginning? "))
error (_("Program not restarted."));
target_kill ();
- no_shared_libraries (NULL, from_tty);
- init_wait_for_inferior ();
}
}
@@ -448,6 +446,8 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
dont_repeat ();
kill_if_already_running (from_tty);
+
+ init_wait_for_inferior ();
clear_breakpoint_hit_counts ();
/* Clean up any leftovers from other runs. Some other things from