From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101752 invoked by alias); 7 Feb 2019 17:23:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 101740 invoked by uid 89); 7 Feb 2019 17:23:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=luck, seemingly, intercepts X-HELO: mail-wm1-f66.google.com Received: from mail-wm1-f66.google.com (HELO mail-wm1-f66.google.com) (209.85.128.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Feb 2019 17:23:41 +0000 Received: by mail-wm1-f66.google.com with SMTP id h22so4888114wmb.0 for ; Thu, 07 Feb 2019 09:23:40 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:4c97:6d52:2cea:997b? ([2001:8a0:f913:f700:4c97:6d52:2cea:997b]) by smtp.gmail.com with ESMTPSA id m6sm18012361wrv.24.2019.02.07.09.23.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Feb 2019 09:23:38 -0800 (PST) Subject: Re: [PATCH 8/8] Special-case wildcard requests in ravenscar-thread.c To: Tom Tromey , gdb-patches@sourceware.org References: <20190207094016.368-1-tom@tromey.com> <20190207094016.368-9-tom@tromey.com> Cc: Tom Tromey From: Pedro Alves Message-ID: <6265465a-55e0-4050-e2ce-f7763702c0b9@redhat.com> Date: Thu, 07 Feb 2019 17:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190207094016.368-9-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-02/txt/msg00072.txt.bz2 On 02/07/2019 09:40 AM, Tom Tromey wrote: > From: Tom Tromey > > ravenscar-thread.c intercepts resume and wait target requests and > replaces the requested ptid with the ptid of the underlying CPU. > However, this is incorrect when a request is made with a wildcard > ptid. Can you clarify a bit more what went wrong? IIRC, the base target always has one thread/cpu only, anyway? What difference does the patch make in practice? The reason I'm wondering is because the patch makes me wonder about a step request with no sched-lock, which is the default (*). In that case, you'll have: - the thread to step is in inferior_ptid - ptid == minus_one_ptid (indicating everything resumes / no schedlock) So seems like after this patch the lower layer might get a request to step an unknown inferior_ptid? Might not happen by luck/accident. I'd suspect that you'd want to do instead: inferior_ptid = m_base_ptid; /* If we see a wildcard resume, we simply pass that on. Otherwise, arrange to resume the base ptid. */ if (ptid != minus_one_ptid) ptid = m_base_ptid; beneath ()->resume (ptid, step, siggnal); I.e., always flip inferior_ptid. (*) since ravenscar-thread.c doesn't know how to interact with the ravenscar runtime to specify which threads are resumable, "schedlock on" most certainly doesn't work properly. E.g., "task 1 stops; set scheduler-locking on; task 2; step" seemingly will step task 1 instead of 2, AFAICT. Thanks, Pedro Alves