From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 057B8388702A for ; Tue, 14 Apr 2020 17:54:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 057B8388702A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-1U3T9oKUPmC898wviIoTBA-1; Tue, 14 Apr 2020 13:54:44 -0400 X-MC-Unique: 1U3T9oKUPmC898wviIoTBA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74635DB60 for ; Tue, 14 Apr 2020 17:54:43 +0000 (UTC) Received: from cascais.Home (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1219B5C1A2 for ; Tue, 14 Apr 2020 17:54:42 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 10/28] Don't write to inferior_ptid in tracectf.c Date: Tue, 14 Apr 2020 18:54:16 +0100 Message-Id: <20200414175434.8047-11-palves@redhat.com> In-Reply-To: <20200414175434.8047-1-palves@redhat.com> References: <20200414175434.8047-1-palves@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-29.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2020 17:54:47 -0000 gdb/ChangeLog: yyyy-mm-dd Pedro Alves =09* tracectf.c (ctf_target_open): Switch to added thread instead of =09writing to inferior_ptid directly. =09(ctf_target::close): Use switch_to_no_thread instead of writing to =09inferior_ptid directly. --- gdb/tracectf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gdb/tracectf.c b/gdb/tracectf.c index 1c7003c2c9..2c9a7495bf 100644 --- a/gdb/tracectf.c +++ b/gdb/tracectf.c @@ -1168,8 +1168,9 @@ ctf_target_open (const char *dirname, int from_tty) push_target (&ctf_ops); =20 inferior_appeared (current_inferior (), CTF_PID); - inferior_ptid =3D ptid_t (CTF_PID); - add_thread_silent (&ctf_ops, inferior_ptid); + + thread_info *thr =3D add_thread_silent (&ctf_ops, ptid_t (CTF_PID)); + switch_to_thread (thr); =20 merge_uploaded_trace_state_variables (&uploaded_tsvs); merge_uploaded_tracepoints (&uploaded_tps); @@ -1187,7 +1188,7 @@ ctf_target::close () xfree (trace_dirname); trace_dirname =3D NULL; =20 - inferior_ptid =3D null_ptid;=09/* Avoid confusion from thread stuff. */ + switch_to_no_thread ();=09/* Avoid confusion from thread stuff. */ exit_inferior_silent (current_inferior ()); =20 trace_reset_local_state (); --=20 2.14.5