Bug 324069 - Implement support for gdb targets with native reverse execution support
Summary: Implement support for gdb targets with native reverse execution support
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-31 05:59 EDT by Kai Schuetz CLA
Modified: 2020-09-04 15:22 EDT (History)
1 user (show)

See Also:


Attachments
Un-finished prototype (10.69 KB, patch)
2010-08-31 16:23 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Schuetz CLA 2010-08-31 05:59:08 EDT
Build Identifier: I20100608-0911

Currently the implementation assumes that Reverse Execution will always be supported by means of "Process Execution and Replay". However, if a target does not support Process Execution and Replay, but does support reverse execution natively, the startup will fail since the "record" command issued to gdb will fail.

One possible solution is to still issue the record command, but ignore if the command fails.

If a target is configured for reverse execution which does not support it the buttons would still appear, but would not work. Since the user has to explicitly enable reverse execution first in the configuration this should not be a problem.


Reproducible: Always

Steps to Reproduce:
1. Configure a target that supports reverse execution, but no replay. (e.g. by implementing a dummy remote serial target).
2. Select "Enable Reverse Debugging at startup" option in Debugger tab
3. Start debugging. A popup will appear:
"Launching THEPROJECT" has encountered a problem. Error in final launch sequence.
Details: Error in final launch sequence
Failed to execute MI command:
record
Error message from debugger back end:
Process record: the current architecture doesn't support record function.
Process record: the current architecture doesn't support record function.
Comment 1 Marc Khouzam CLA 2010-08-31 10:38:57 EDT
From the cdt-dev mailing list:

-----Original Message-----

From: cdt-dev-bounces@eclipse.org [mailto:cdt-dev-bounces@eclipse.org] On Behalf Of Kai Schuetz

Sent: Tuesday, August 31, 2010 6:07 AM

To: CDT General developers list.

Subject: Re: [cdt-dev] DSF-GDB: How to support targets which natively support reverse execution ?



I’ve entered Bug 324069 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=324069>  for this.




I was not able to find a gdb command to query if reverse execution is supported, at least not side-effect free. When issuing a command like reverse-step an error will occur if not supported, however this has a side-effect.




For targets connected via the remote serial protocol there is the qSupported command telling if reverse stepping and continuation are supported.



Since the used has to explicitly enable reverse execution in the CDT Debugger configuration tab maybe it’s not a problem to show the buttons, even if they will not work ?




Kai
Comment 2 Marc Khouzam CLA 2010-08-31 10:40:11 EDT
(In reply to comment #1)

> I was not able to find a gdb command to query if reverse execution is
> supported, at least not side-effect free. When issuing a command like
> reverse-step an error will occur if not supported, however this has a
> side-effect.

I played around a bit and found that this may work:



> gdb.7.0 -i mi a.out

(gdb) 

start

(gdb) 

-gdb-set exec-direction reverse

^done

(gdb) 

show exec-direction

&"show exec-direction\n"

~"Forward.\n"

^done

(gdb)

-gdb-set exec-direction forward

^done



I noticed a bug if we use -gdb-show instead of 'show', where

it actually reports Reverse.  So we must use 'show'.



Can you try with your target and let me know if it reports

Reverse properly?  Process Record and Replay does.
Comment 3 Marc Khouzam CLA 2010-08-31 15:14:43 EDT
The trick here will be to decouple the reverse execution buttons from the toggle reverse button.  How things work now is that the buttons only appear once the user has pressed on the toggle reverse button.

What I think we should do is to try to make the buttons appear when a target supports reverse execution.  We'll have to figure out when is the right time to ask the target about its support.  Should be after the command to connect to a remote target, but maybe also after starting the execution of the program.

I'm not sure what to do about the current 'toggle reverse debugging' button in that case.  In DSF-GDB, that button is really tied to the 'record' command.
Comment 4 Marc Khouzam CLA 2010-08-31 16:23:26 EDT
Created attachment 177885 [details]
Un-finished prototype

I wrote the beginning of a prototype to illustrate what I had in mind.
Comment 5 Marc Khouzam CLA 2010-08-31 16:29:30 EDT
Using 
-gdb-set exec-direction reverse
may not prove as simple as I hoped.

Using this command has no side-effects, only if the target is not currently running, so we have to be careful when we send it.  In the case of non-stop mode, we may connect to a running target that will not be interrupted.  So, we can't use this trick for non-stop.  There may be no solution for non-stop, except to assume the target supports reverse, and then turn it off when the first reverse command fails.
Comment 6 Marc Khouzam CLA 2010-09-02 08:14:26 EDT
I've added a fix to GDB so that -list-target-features will show if reverse execution is supported on the current target.  However, this fix will only be available starting with GDB 7.2.

http://sourceware.org/ml/gdb-patches/2010-09/msg00053.html