From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 584B43945047 for ; Tue, 14 Apr 2020 17:54:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 584B43945047 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-6-_RsGkh98OYiduKgl8gmQyw-1; Tue, 14 Apr 2020 13:54:49 -0400 X-MC-Unique: _RsGkh98OYiduKgl8gmQyw-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 CC3DDDB6B for ; Tue, 14 Apr 2020 17:54:48 +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 690569F9AC for ; Tue, 14 Apr 2020 17:54:48 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 17/28] Don't write to inferior_ptid in corelow.c Date: Tue, 14 Apr 2020 18:54:23 +0100 Message-Id: <20200414175434.8047-18-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.7 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:52 -0000 gdb/ChangeLog: yyyy-mm-dd Pedro Alves =09* corelow.c (core_target::close): Use switch_to_no_thread instead =09of writing to inferior_ptid directly. =09(add_to_thread_list, core_target_open): Use switch_to_thread =09instead of writing to inferior_ptid directly. --- gdb/corelow.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/gdb/corelow.c b/gdb/corelow.c index b60010453d..b6a12c0818 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -160,8 +160,8 @@ core_target::close () { if (core_bfd) { - inferior_ptid =3D null_ptid; /* Avoid confusion from thread -=09=09=09=09 stuff. */ + switch_to_no_thread (); /* Avoid confusion from thread +=09=09=09=09 stuff. */ exit_inferior_silent (current_inferior ()); =20 /* Clear out solib state while the bfd is still open. See @@ -182,7 +182,6 @@ core_target::close () static void add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) { - ptid_t ptid; int core_tid; int pid, lwpid; asection *reg_sect =3D (asection *) reg_sect_arg; @@ -210,15 +209,15 @@ add_to_thread_list (bfd *abfd, asection *asect, void = *reg_sect_arg) inf->fake_pid_p =3D fake_pid_p; } =20 - ptid =3D ptid_t (pid, lwpid, 0); + ptid_t ptid (pid, lwpid); =20 - add_thread (inf->process_target (), ptid); + thread_info *thr =3D add_thread (inf->process_target (), ptid); =20 /* Warning, Will Robinson, looking at BFD private data! */ =20 if (reg_sect !=3D NULL && asect->filepos =3D=3D reg_sect->filepos)=09/* Did we find .reg? = */ - inferior_ptid =3D ptid;=09=09=09/* Yes, make it current. */ + switch_to_thread (thr);=09=09=09/* Yes, make it current. */ } =20 /* Issue a message saying we have no core to debug, if FROM_TTY. */ @@ -339,7 +338,7 @@ core_target_open (const char *arg, int from_tty) =20 push_target (std::move (target_holder)); =20 - inferior_ptid =3D null_ptid; + switch_to_no_thread (); =20 /* Need to flush the register cache (and the frame cache) from a previous debug session. If inferior_ptid ends up the same as the @@ -368,11 +367,10 @@ core_target_open (const char *arg, int from_tty) if (thread =3D=3D NULL) =09{ =09 inferior_appeared (current_inferior (), CORELOW_PID); -=09 inferior_ptid =3D ptid_t (CORELOW_PID); -=09 add_thread_silent (target, inferior_ptid); +=09 thread =3D add_thread_silent (target, ptid_t (CORELOW_PID)); =09} - else -=09switch_to_thread (thread); + + switch_to_thread (thread); } =20 if (exec_bfd =3D=3D nullptr) --=20 2.14.5