From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14450 invoked by alias); 29 Sep 2013 17:24:26 -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 14436 invoked by uid 89); 29 Sep 2013 17:24:25 -0000 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; Sun, 29 Sep 2013 17:24:25 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8THOKkF005193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 29 Sep 2013 13:24:20 -0400 Received: from host2.jankratochvil.net (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8THOGWA004079 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 29 Sep 2013 13:24:19 -0400 Date: Sun, 29 Sep 2013 17:24:00 -0000 From: Jan Kratochvil To: "Metzger, Markus T" Cc: "gdb-patches@sourceware.org" Subject: Re: [patch v4 23/24] record-btrace: add (reverse-)stepping support Message-ID: <20130929172416.GA15087@host2.jankratochvil.net> References: <1372842874-28951-1-git-send-email-markus.t.metzger@intel.com> <1372842874-28951-24-git-send-email-markus.t.metzger@intel.com> <20130818190935.GR24153@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00994.txt.bz2 On Tue, 17 Sep 2013 11:43:28 +0200, Metzger, Markus T wrote: > But this code compares a NORMAL_FRAME from before the step with a > BTRACE_FRAME from after the wait. They will always be unequal hence > we will never recognize that we just reverse-stepped into a function. > > When I reset the frame cache, GDB re-computes the stored frame and now > compares two BTRACE_FRAMEs, which works OK. [...] > See above. Alternatively, I might add a special case to frame comparison, > but this would be quite ugly, as well. Do you have a better idea? +record_btrace_start_replaying (struct thread_info *tp) [...] + /* Make sure we're not using any stale registers. */ + registers_changed_ptid (tp->ptid); + + /* We just started replaying. The frame id cached for stepping is based + on unwinding, not on branch tracing. Recompute it. */ + frame = get_current_frame_nocheck (); + insn = btrace_insn_get (replay); + sal = find_pc_line (insn->pc, 0); + set_step_info (frame, sal); The problem comes from the new commands like "record goto" which change inferior content without resuming+stopping it. Former "record full" could only change history position by "step/reverse-step" (or similar commands) which did resume+stop the inferior. To make the "record goto" command friendly to the GDB infrastructure expectations I think you should put a temporary breakpoint to the target instruction, resume the inferior and simulate stop at the temporary breakpoint. I think all the registers_changed_ptid() calls could be removed afterwards. > > Proposing some hacked draft patch but for some testcases it FAILs for me; > > but they FAIL even without this patch as I run it on Nehalem. I understand I > > may miss some problem there, though. > > > > > > > It looks like I don't need any special support for breakpoints. Is > > > there a scenario where normal breakpoints won't work? > > > > You already handle it specially in BTHR_CONT and in BTHR_RCONT by > > breakpoint_here_p. As btrace does not record any data changes that may > > be enough. "record full" has different situation as it records data changes. > > I think it is fine as you wrote it. > > > > You could handle BTHR_CONT and BTHR_RCONT equally to BTHR_STEP and > > BTHR_RSTEP, just returning TARGET_WAITKIND_SPURIOUS instead of > > TARGET_WAITKIND_STOPPED. > > This way you would not need to handle specially breakpoint_here_p. > > But it would be sure slower. > > I don't think performance is an issue, here. I tried that and it didn't seem > to stop correctly resulting in lots of test fails. I have not investigated it. My idea was wrong, handle_inferior_event checks for breakpoint_inserted_here_p() only if it sees GDB_SIGNAL_TRAP. With TARGET_WAITKIND_SPURIOUS it does not notice any breakpoint. (One could return TARGET_WAITKIND_SPURIOUS instead of looping in BTHR_CONT+BTHR_RCONT but that has no advantage, it is just slower.) And sure reporting GDB_SIGNAL_TRAP without breakpoint_inserted_here_p() also does not work, that ends up with: Program received signal SIGTRAP, Trace/breakpoint trap. So I agree with your implementation, record-full.c also does it that way. > > > Non-stop mode is not working. Do not allow record-btrace in non-stop > > mode. > > > > While that seems OK for the initial check-in I do not think it is convenient. > > Some users use for example Eclipse in non-stop mode, they would not be > > able to use btrace then as one cannot change non-stop state when the > > inferior is running. You can just disable the ALL_THREADS cases in record- > > btrace.c, can't you? > > Record-full is not supporting non-stop, either. I'm wondering what other > issues I might run into with non-stop mode that I am currently not aware of. I do not know an answer without trying it. Thanks, Jan