This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Replace finish_thread_state_cleanup with a RAII class
- From: Simon Marchi <simon dot marchi at polymtl dot ca>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 30 Mar 2018 01:58:55 -0400
- Subject: Re: [PATCH] Replace finish_thread_state_cleanup with a RAII class
- References: <20180328144428.15032-1-palves@redhat.com>
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