Message ID | 5fbd40b5-7887-1000-3457-75190a5d96c0@cs.ucla.edu |
---|---|
State | New, archived |
Headers |
Received: (qmail 10369 invoked by alias); 10 Apr 2019 04:19:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10298 invoked by uid 89); 10 Apr 2019 04:19:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=recording, replay, Replay, tracked X-HELO: zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu (HELO zimbra.cs.ucla.edu) (131.179.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Apr 2019 04:19:23 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3DB221615EA for <gdb-patches@sourceware.org>; Tue, 9 Apr 2019 21:19:22 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Jspot47BCaXJ for <gdb-patches@sourceware.org>; Tue, 9 Apr 2019 21:19:21 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2BFC01615FF for <gdb-patches@sourceware.org>; Tue, 9 Apr 2019 21:19:21 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5Uus1OzuRSZd for <gdb-patches@sourceware.org>; Tue, 9 Apr 2019 21:19:21 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 09213161589 for <gdb-patches@sourceware.org>; Tue, 9 Apr 2019 21:19:21 -0700 (PDT) To: gdb-patches@sourceware.org From: Paul Eggert <eggert@cs.ucla.edu> Subject: reverse execution part of the manual is written backwards Message-ID: <5fbd40b5-7887-1000-3457-75190a5d96c0@cs.ucla.edu> Date: Tue, 9 Apr 2019 21:19:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit |
Commit Message
Paul Eggert
April 10, 2019, 4:19 a.m. UTC
[resent from https://sourceware.org/bugzilla/show_bug.cgi?id=24417] At least two Emacs developers were confused by GDB's documentation for reverse execution. One said he could never get it to work and recommended another debugger instead since it always worked for him. We tracked down the issue to a problem in GDB's documentation: it documents how to do reverse execution, but never mentions until a later section that you can't use reverse execution unless you first turn on process recording. Surely it's not intended that one must read the GDB documentation backwards in order to know how to do reverse execution.... Proposed patch follows. This is just a minor doc patch so I assume no ChangeLog entry is needed. @kindex reverse-continue
Comments
On 4/10/19 5:19 AM, Paul Eggert wrote: > [resent from https://sourceware.org/bugzilla/show_bug.cgi?id=24417] > > At least two Emacs developers were confused by GDB's documentation for reverse execution. One said he could never get it to work and recommended another debugger instead since it always worked for him. We tracked down the issue to a problem in GDB's documentation: it documents how to do reverse execution, but never mentions until a later section that you can't use reverse execution unless you first turn on process recording. > > Surely it's not intended that one must read the GDB documentation backwards in order to know how to do reverse execution.... > > Proposed patch follows. This is just a minor doc patch so I assume no ChangeLog entry is needed. > > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index f410d026b8..147c7c0f37 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -6697,8 +6697,11 @@ assumes that the memory and registers that the target reports are in a > consistant state, but @value{GDBN} accepts whatever it is given. > }. > > -If you are debugging in a target environment that supports > -reverse execution, @value{GDBN} provides the following commands. > +Before using reverse execution, you should first use the @code{record} > +command, so that instructions executed by the program are saved for > +reverse execution later. @xref{Process Record and Replay}. > +@value{GDBN} provides the following commands to examine the process > +record and execute the program in reverse. This is not correct. "record" is one way to support reverse execution, but there are others. For example, "record" is an alias for "record full". "record btrace" also supports reverse debugging. And then there are remote targets that suppose reverse debugging natively, like system emulators, and you won't type "record" with those at all. Mozilla's RR is another example. https://www.gnu.org/software/gdb/news/reversible.html > > @table @code > @kindex reverse-continue Thanks, Pedro Alves
> From: Pedro Alves <palves@redhat.com> > Date: Wed, 10 Apr 2019 12:51:36 +0100 > > > +Before using reverse execution, you should first use the @code{record} > > +command, so that instructions executed by the program are saved for > > +reverse execution later. @xref{Process Record and Replay}. > > +@value{GDBN} provides the following commands to examine the process > > +record and execute the program in reverse. > > This is not correct. "record" is one way to support reverse execution, > but there are others. For example, "record" is an alias for "record full". > "record btrace" also supports reverse debugging. And then there are > remote targets that suppose reverse debugging natively, like system emulators, > and you won't type "record" with those at all. Mozilla's RR is another > example. > > https://www.gnu.org/software/gdb/news/reversible.html Pedro, First, thanks for responding, I posted a similar question to gdb@, and only got one uncertain response. What you wrote is much more definitive. Next, please try to put yourself in the shoes of a GDB user who is debugging a native target, let's say on GNU/Linux. How would such a user know what to do to start using the reverse debugging feature? The above URL basically says that reverse debugging is available natively only on GNU/Linux running on x86 CPUs, and then only if one activates "target record". This is essentially what Paul was saying, so he wasn't very far off the mark. The remote targets are an important addition to what Paul said. In any case, I think the Reverse Execution section should say something about the conditions for using this mode, regardless of whether it precedes or follows the chapter about recording and replaying. It probably should simply say what the above URL says at its beginning, and then describe the commands to activate the correct target, or point to a clear description of those commands elsewhere in the manual. Because right now we have a description of record and replay, and we have a description of reverse-execution commands, but no "glue" to connect them, and there's no reasonable way for a reader to guess what to do to bridge over that chasm. Do you agree?
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f410d026b8..147c7c0f37 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -6697,8 +6697,11 @@ assumes that the memory and registers that the target reports are in a consistant state, but @value{GDBN} accepts whatever it is given. }. -If you are debugging in a target environment that supports -reverse execution, @value{GDBN} provides the following commands. +Before using reverse execution, you should first use the @code{record} +command, so that instructions executed by the program are saved for +reverse execution later. @xref{Process Record and Replay}. +@value{GDBN} provides the following commands to examine the process +record and execute the program in reverse. @table @code