aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2018-04-10 14:49:30 +0100
committerPedro Alves <palves@redhat.com>2018-04-10 14:49:30 +0100
commit731f534f918cfaa35c20b5eb6220a8eba4819f04 (patch)
tree32d4b440a20836edfca758a05a36629c745e1d54 /gdb/infcmd.c
parentd4ae1932770d9ec76f3d0a429aab45f1cb15e964 (diff)
downloadgdb-731f534f918cfaa35c20b5eb6220a8eba4819f04.zip
gdb-731f534f918cfaa35c20b5eb6220a8eba4819f04.tar.gz
gdb-731f534f918cfaa35c20b5eb6220a8eba4819f04.tar.bz2
Replace finish_thread_state_cleanup with a RAII class
gdb/ChangeLog: 2018-04-10 Pedro Alves <palves@redhat.com> * gdbthread.h (finish_thread_state_cleanup): Delete declaration. (scoped_finish_thread_state): New class. * infcmd.c (run_command_1): Use it instead of finish_thread_state cleanup. * infrun.c (proceed, prepare_for_detach, wait_for_inferior) (fetch_inferior_event, normal_stop): Likewise. * thread.c (finish_thread_state_cleanup): Delete.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9c236b8..d43e7f2 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -565,8 +565,6 @@ static void
run_command_1 (const char *args, int from_tty, enum run_how run_how)
{
const char *exec_file;
- struct cleanup *old_chain;
- ptid_t ptid;
struct ui_out *uiout = current_uiout;
struct target_ops *run_target;
int async_exec;
@@ -655,11 +653,10 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
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);
+ ptid_t finish_ptid = (non_stop
+ ? ptid_t (current_inferior ()->pid)
+ : minus_one_ptid);
+ scoped_finish_thread_state finish_state (finish_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. */
@@ -680,7 +677,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
/* Since there was no error, there's no need to finish the thread
states here. */
- discard_cleanups (old_chain);
+ finish_state.release ();
}
static void