From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13899 invoked by alias); 3 Jun 2005 19:55:35 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 13883 invoked by uid 22791); 3 Jun 2005 19:55:29 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 03 Jun 2005 19:55:29 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j53JtSoJ001862 for ; Fri, 3 Jun 2005 15:55:28 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j53JtRO04620 for ; Fri, 3 Jun 2005 15:55:28 -0400 Received: from [172.16.24.50] (bluegiant.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id j53JtQZF010991; Fri, 3 Jun 2005 15:55:26 -0400 Message-ID: <42A0B5AD.1060401@redhat.com> Date: Fri, 03 Jun 2005 19:55:00 -0000 From: Michael Snyder User-Agent: Mozilla Thunderbird (X11/20050322) MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: [reverse] A "toy" implementation of reverse execution Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-06/txt/msg00026.txt.bz2 Hey folks, Here's a "toy" implementation of a target that can, to a very limited extent, act as if it's offering reverse execution to gdb. I hope it will be useful for trying out ideas. It should be useful for both the "bookmark" approach and the "reverse-stepi" method. What I've done is, starting from the "sample" program in RDA, I added the ability to understand "tfind" requests, and then added on a module that could read simplified tracepoint frames from a file, and then serve them back to gdb. Then I generated a trace frame file from the testsuite program "break.c", starting at main and saving a tracepoint for every instruction. It only took about 157 frames. ;-) Now, if I feed that file to my rda-derived trace frame server, "tfind next" becomes equivalent to "stepi", and "tfind prev" becomes equivalent to "reverse-stepi". With those as primatives, reverse-step turns out to be, to first approximation at least, fairly easy: define reverse-si tfind - end define si tfind end define unstep reverse-si set $foo=$trace_line while $foo==$trace_line reverse-si end si end As several of us speculated, the algorhythm for stepping backward involves first taking a backstep, then establishing the line range and stepping out of it, and finally taking one forward step. I've created a branch and checked in my modified rda, along with a hacked-up gdb that I'm using to help create trace frame files. The branch is "msnyder-tracepoint-checkpoint-branch", and y'all are welcome to play with it. There's a README-CHECKPOINTS file.