This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Use "switch_to_thread" more thoroughly on gdbserver
- From: Pedro Alves <palves at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Tue, 26 Sep 2017 13:28:26 +0100
- Subject: Re: [PATCH v2] Use "switch_to_thread" more thoroughly on gdbserver
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E1E097F756
- References: <20170915043357.26094-1-sergiodj@redhat.com> <20170926042239.30748-1-sergiodj@redhat.com>
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