From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22585 invoked by alias); 17 Dec 2013 15:07:27 -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 22566 invoked by uid 89); 17 Dec 2013 15:07:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Dec 2013 15:07:25 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 17 Dec 2013 07:02:54 -0800 X-ExtLoop1: 1 Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga001.jf.intel.com with ESMTP; 17 Dec 2013 07:06:17 -0800 Received: from irsmsx152.ger.corp.intel.com (163.33.192.66) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 17 Dec 2013 15:06:10 +0000 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.135]) by IRSMSX152.ger.corp.intel.com ([169.254.6.169]) with mapi id 14.03.0123.003; Tue, 17 Dec 2013 15:06:10 +0000 From: "Metzger, Markus T" To: Pedro Alves CC: "jan.kratochvil@redhat.com" , "gdb-patches@sourceware.org" , Eli Zaretskii Subject: RE: [patch v8 24/24] record-btrace: add (reverse-)stepping support Date: Tue, 17 Dec 2013 15:07:00 -0000 Message-ID: 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="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00646.txt.bz2 > -----Original Message----- > From: Metzger, Markus T > Sent: Tuesday, December 17, 2013 3:15 PM > To: Pedro Alves > > >>> + if (breakpoint_here_p (aspace, insn->pc)) > > >>> + return btrace_step_stopped (); > > >> > > >> How is adjust_pc_after_break handled? > > > > > > I'm not doing anything special. The PC register is writable, > > > so the PC can be adjusted. > > > > Eh, it's writable even when forward executing through history? > > > > I see this in patch 14: > > > > > +static void > > > +record_btrace_store_registers (struct target_ops *ops, > > > + struct regcache *regcache, int regno) > > > +{ > > > + struct target_ops *t; > > > + > > > + if (record_btrace_is_replaying ()) > > > + error (_("This record target does not allow writing registers.")= ); > > > + > > > > Was it changed in later patches? >=20 > Oops. You are right. It is read-only. >=20 > After some playing around, I also managed to trigger the error > when adjust_pc_after_break tries to write the adjusted PC. >=20 > I'm inclined to simply allow it. The adjusted PC will be ignored for > stepping, of course. We just follow the recorded execution. >=20 > Concerns? Besides RIP, we also write orig_rax, so we still fail. I'm beginning to wonder if we should actually adjust the PC for btrace replay. The way I interpret the function, we got a SIGTRAP for executing the breakpoint instruction. The PC is after the breakpoint instruction, so it is one byte after the actual breakpoint location. We're now trying to undo the execution of the breakpoint instruction. Is this correct? In that case, we shouldn't adjust the PC since we did not execute the breakpoint instruction in the trace. We just asked whether there is a breakpoint at the current location. This seems to be different for s/w record. This is the first time, I need to distinguish between the different record targets. I would add a new target method to_omit_pc_after_break_adjustment that would default to false if not present. The btrace record target will provide it and return true if we're replaying. OK with that? Regards, Markus. Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052