[PATCH] Replace finish_thread_state_cleanup with a RAII class
Simon Marchi
simon.marchi@polymtl.ca
Fri Mar 30 05:59:00 GMT 2018
On 2018-03-28 10:44, Pedro Alves wrote:
> A small patch I was sitting on in the multi-target branch.
>
> gdb/ChangeLog:
> yyyy-mm-dd 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.
LGTM, two tiny nits:
> @@ -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
> + ? pid_to_ptid (current_inferior ()->pid)
Nit: you could use the ptid_t constructor (I saw you used it somewhere
else in the patch).
> @@ -8164,7 +8159,6 @@ normal_stop (void)
> {
> struct target_waitstatus last;
> ptid_t last_ptid;
> - struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
> ptid_t pid_ptid;
pid_ptid is now unused.
Simon
More information about the Gdb-patches
mailing list