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 56A09385C426 for ; Thu, 16 Apr 2020 14:58:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56A09385C426 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-_UAcKERwPseTlNUZ6cuCVQ-1; Thu, 16 Apr 2020 10:58:16 -0400 X-MC-Unique: _UAcKERwPseTlNUZ6cuCVQ-1 Received: by mail-ej1-f70.google.com with SMTP id cb22so1080417ejb.12 for ; Thu, 16 Apr 2020 07:58:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rQ39NeiyHMskaROrCdGgXUB2j+9QO928daLvAQ3Ik10=; b=BMmOVcNE31Z9la/AWGPHVYxqcCnqg5LNxHdBDtMvVgVTQ5Si8Ui3SUoLIOew0cZang iVFG60+6G8IZzLVkPzWkK7RcGqDOt5MAllfYEIFTKTGQaBIt/O5nES56L+awKtH9Wc5h iSlsSEYi3j1xqbxLM9e/5pnLmD6V6J3zRpFA3ustAY2eR6Pxl8NYQfCJrTN6SGYW2QUN I4ZF7s3WVRN18CxsE6MfMyZ/xU4Sg72EbJrkWcMi8PKZopVzAl5lPXBlhWa1NUUNpvAV 6yJDeXpPPuhpsQT+EJTBIG0uNxXCw/qF4wDss2V+XNjFMjKYguSvpiZxSgx1mTMogrla hlyw== X-Gm-Message-State: AGi0Pub8w7sepf2TY5zEcXgaK+SZfvE3MqKPp9yor6YFpeiVAoHxBagN sJlOhoYAxalOjpUzsbe+P2MFX7jwaRoVNG5Qi+6vXTCdqhsv6F/hZS0jfKhjQxToUuf4VPHtZCH 8Xm+7E9szbPw/fqbMXDOjRA== X-Received: by 2002:aa7:d3d3:: with SMTP id o19mr12005005edr.76.1587049095175; Thu, 16 Apr 2020 07:58:15 -0700 (PDT) X-Google-Smtp-Source: APiQypITiBjWCh9IW7XICkvHrOb1F388G3a6r31pArSYOCLSR5jGUcqhdi9maJNDukVqOFoCJWscSg== X-Received: by 2002:aa7:d3d3:: with SMTP id o19mr12004996edr.76.1587049094958; Thu, 16 Apr 2020 07:58:14 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id p22sm3052198ejd.24.2020.04.16.07.58.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Apr 2020 07:58:13 -0700 (PDT) Subject: Re: [PATCH 23/28] Don't write to inferior_ptid in remote-sim.c To: Simon Marchi , gdb-patches@sourceware.org References: <20200414175434.8047-1-palves@redhat.com> <20200414175434.8047-24-palves@redhat.com> <7f0effa7-4a24-5bec-d52f-3fdb5474fa87@simark.ca> From: Pedro Alves Message-ID: <3db6cba3-50cf-e7e6-ebf6-6c69738620eb@redhat.com> Date: Thu, 16 Apr 2020 15:58:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <7f0effa7-4a24-5bec-d52f-3fdb5474fa87@simark.ca> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-24.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: Thu, 16 Apr 2020 14:58:28 -0000 On 4/16/20 1:53 AM, Simon Marchi wrote: > On 2020-04-14 1:54 p.m., Pedro Alves via Gdb-patches wrote: >> gdb/ChangeLog: >> yyyy-mm-dd Pedro Alves >> >> * remote-sim.c (gdbsim_target::create_inferior): Switch to thread >> after creating it, instead of writing to inferior_ptid. >> (gdbsim_target::wait): Don't write to inferior_ptid. > > I noticed there's 2 "remote-sim.c" patches in this series. If there's no reason for them > to be separate, I think they should be merged. Otherwise, they should be given different > subjects. > Whoops, thanks for noticing. There's no reason for them to be separate. Just wrote them in different passes and didn't notice it. Here's what they look like merged as one. >From 36fd318f59ba41310d0820953a37743fc989c927 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 16 Apr 2020 15:54:13 +0100 Subject: [PATCH] Don't write to inferior_ptid in remote-sim.c gdb/ChangeLog: yyyy-mm-dd Pedro Alves * remote-sim.c (gdbsim_target::create_inferior): Switch to thread after creating it, instead of writing to inferior_ptid. (gdbsim_target_open): Use switch_to_no_thread instead of writing to inferior_ptid directly. (gdbsim_target::wait): Don't write to inferior_ptid. --- gdb/remote-sim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 347dfd7013..9af6486bca 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -653,9 +653,10 @@ gdbsim_target::create_inferior (const char *exec_file, != SIM_RC_OK) error (_("Unable to create sim inferior.")); - inferior_ptid = sim_data->remote_sim_ptid; - inferior_appeared (current_inferior (), inferior_ptid.pid ()); - add_thread_silent (this, inferior_ptid); + inferior_appeared (current_inferior (), + sim_data->remote_sim_ptid.pid ()); + thread_info *thr = add_thread_silent (this, sim_data->remote_sim_ptid); + switch_to_thread (thr); insert_breakpoints (); /* Needed to get correct instruction in cache. */ @@ -761,7 +762,7 @@ gdbsim_target_open (const char *args, int from_tty) /* There's nothing running after "target sim" or "load"; not until "run". */ - inferior_ptid = null_ptid; + switch_to_no_thread (); gdbsim_is_open = 1; } @@ -945,7 +946,6 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options) if (sim_data == NULL) error (_("Unable to wait for pid %d. Inferior not found."), ptid.pid ()); - inferior_ptid = ptid; } if (remote_debug) -- 2.14.5