This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Use "switch_to_thread" more thoroughly on gdbserver


On 09/26/2017 05:22 AM, Sergio Durigan Junior wrote:

> gdb/gdbserver/ChangeLog:
> yyyy-mm-dd  Sergio Durigan Junior  <sergiodj@redhat.com>
> 
> 	* gdbthread.h: Include "common-gdbthread.h".
> 	* inferiors.c (switch_to_thread): Use "gdb_assert" instead of
> 	"if" when validating the ptid.
> 	* remote-utils.c: Include "gdbthread.h".
> 	(prepare_resume_reply): Use "switch_to_thread".
> 	* target.c (done_accessing_memory): Likewise.

OK

>  void
>  switch_to_thread (ptid_t ptid)
>  {
> -  if (!ptid_equal (ptid, minus_one_ptid))
> -    current_thread = find_thread_ptid (ptid);
> +  gdb_assert (!ptid_equal (ptid, minus_one_ptid));

Note you can write:

  gdb_assert (ptid != minus_one_ptid);

nowadays.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]