diff options
author | Pedro Alves <palves@redhat.com> | 2009-01-18 17:42:16 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-01-18 17:42:16 +0000 |
commit | 29f49a6a4f3f165090de6c85fdb0f29dcb579ae7 (patch) | |
tree | 5af7a780ad9ac00b0d292c3f4b1bf92d173a3d5b /gdb/infcmd.c | |
parent | e7243d734732b21fd5b2323fa4e727e4b56c0b79 (diff) | |
download | gdb-29f49a6a4f3f165090de6c85fdb0f29dcb579ae7.zip gdb-29f49a6a4f3f165090de6c85fdb0f29dcb579ae7.tar.gz gdb-29f49a6a4f3f165090de6c85fdb0f29dcb579ae7.tar.bz2 |
PR gdb/9747:
* gdbthread.h (finish_thread_state, finish_thread_state_cleanup):
Declare.
* thread.c (finish_thread_state, finish_thread_state_cleanup): New.
* infrun.c (wait_for_inferior, fetch_inferior_event): If an error
is thrown while handling an event, finish the thread state.
(normal_stop): Use finish_thread_state cleanup.
* infcmd.c (run_command_1): If an error is thrown while starting
the inferior, finish the thread state.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 3ed6545..2cd583c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -456,6 +456,8 @@ static void run_command_1 (char *args, int from_tty, int tbreak_at_main) { char *exec_file; + struct cleanup *old_chain; + ptid_t ptid; dont_repeat (); @@ -544,14 +546,29 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main) target_create_inferior (exec_file, get_inferior_args (), environ_vector (inferior_environ), from_tty); + /* We're starting off a new process. When we get out of here, in + non-stop mode, finish the state of all threads of that process, + but leave other threads alone, as they may be stopped in internal + events --- the frontend shouldn't see them as stopped. In + all-stop, always finish the state of all threads, as we may be + resuming more than just the new process. */ + if (non_stop) + ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); + else + ptid = minus_one_ptid; + old_chain = make_cleanup (finish_thread_state_cleanup, &ptid); + /* Pass zero for FROM_TTY, because at this point the "run" command has done its thing; now we are setting up the running program. */ post_create_inferior (¤t_target, 0); /* Start the target running. */ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0); -} + /* Since there was no error, there's no need to finish the thread + states here. */ + discard_cleanups (old_chain); +} static void run_command (char *args, int from_tty) |