Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 488661

Summary: Reverse toggle icon does not handle multiple debug sessions
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debugAssignee: Ravitheja Addepally <ravitheja.addepally>
Status: RESOLVED FIXED QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3 CC: cdtdoug, marc.khouzam, ravitheja.addepally
Version: 8.8.1   
Target Milestone: 9.0.0   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/67737
https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=7a73b0035f03d018ce7aa90f10a143bdb3ad38b8
https://git.eclipse.org/r/69166
https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=6d5e31038c76245ebd4b61f0e17929e76ebbc3e8
Whiteboard:

Description Marc Khouzam CLA 2016-02-28 23:47:43 EST
1- start two all-stop debug sessions with gdb 7.10
2- enable software reverse debug for session 1
3- select session 2 and observe that the reverse toggle shows "Software off"
4- select session 1 and enable hardware reverse (from the previous software reverse)
5- select session 2
=> the toggle reverse button for session 2 now shows "hardware off"

Basically, when off, the reverse toggle will show the enabled option of whatever session was last selected.

The problem is that ReverseToggleCommandHandler.updateElement() uses a global member 'fLastTraceMethod' to store what the last option was.  However, this global is shared between all sessions and gets changes as different sessions are selected.

We should not be using global variables in ReverseToggleCommandHandler but instead must rely on the current selection and the services to figure out what is going on.

If there is no feasible solution to remember the proper last option, maybe keeping the current behaviour with the bug is better than removing it?  I'm not sure.
Comment 1 Marc Khouzam CLA 2016-02-29 06:41:15 EST
(In reply to Marc Khouzam from comment #0)

> We should not be using global variables in ReverseToggleCommandHandler but
> instead must rely on the current selection and the services to figure out
> what is going on.

I wonder if the Map of parameters passed to ReverseToggleCommandHandler.updateElement() could help here?
Comment 2 Eclipse Genie CLA 2016-03-03 07:15:19 EST
New Gerrit change created: https://git.eclipse.org/r/67737
Comment 4 Marc Khouzam CLA 2016-03-23 12:55:22 EDT
Thanks for the patch