From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15657 invoked by alias); 17 Dec 2013 20:07:17 -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 15646 invoked by uid 89); 17 Dec 2013 20:07:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Dec 2013 20:07:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBHK7CLC024798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 17 Dec 2013 15:07:13 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBHK7A2P017897; Tue, 17 Dec 2013 15:07:11 -0500 Message-ID: <52B0AEEE.7030803@redhat.com> Date: Tue, 17 Dec 2013 20:07:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Metzger, Markus T" CC: "jan.kratochvil@redhat.com" , "gdb-patches@sourceware.org" , Eli Zaretskii Subject: Re: [patch v8 24/24] record-btrace: add (reverse-)stepping support References: <1386839747-8860-1-git-send-email-markus.t.metzger@intel.com> <1386839747-8860-25-git-send-email-markus.t.metzger@intel.com> <52AB5E6A.1010105@redhat.com> <52AF62CB.7010805@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-12/txt/msg00661.txt.bz2 On 12/17/2013 02:14 PM, Metzger, Markus T wrote: > Does scheduler locking set inferior_ptid? > If it does, we should already get the desired behaviour. It does, but only by chance. The thread to resume will be in ptid passed to target_resume. But I confirm the code already does the right thing. > > >>>>> + /* Find the thread to move. */ >>>>> + if (ptid_equal (minus_one_ptid, ptid) || ptid_is_pid (ptid)) >>>>> + { >>>>> + ALL_THREADS (tp) >>>>> + record_btrace_resume_thread (tp, flag); >>>> >>>> Seems like this steps all threads, when gdb only wants to >>>> step inferior_ptid and continue others? >>> >>> Only if gdb passes -1 or the ptid of the process. >> >> Yes, but -1 or "ptid of the process" means "step inferior_ptid >> and let others run free". > > See below. > > >>> In the end, we will move exactly one thread and keep all >>> others where they are. This one thread will hit a breakpoint >>> or run out of execution history. >> >> Some of the other threads can hit a breakpoint before the >> current thread hits one too. > > That depends on thread interleaving. There is no guarantee that > the other threads make progress. The way it is currently > implemented, we step the chosen thread until the next event. > This event is either a breakpoint, step completed, or out of > execution history. > > We're effectively only stepping a single thread. I believe this > is also how the s/w record target works. I'd understand that if the code looked obviously like but, how the quoted code above seems to be resuming/stepping all threads? /* Find the thread to move. */ if (ptid_equal (minus_one_ptid, ptid) || ptid_is_pid (ptid)) { ALL_THREADS (tp) record_btrace_resume_thread (tp, flag); > But this means that I would rely on inferior_ptid in to_resume > if -1 or the process id is passed. That's fine. target_resume is telling the target "resume _this_", albeit getting what "this" is has a weird interface. It's target_wait that's the problem. The user can have e.g., thread 3 selected (meaning inferior_ptid points at thread 3), while target_wait returns an event for some other thread. There's really no connection here. -- Pedro Alves