Community
Participate
Working Groups
The Watch action in the editor is only visible when the system property "org.eclipse.cdt.debug.ui.debuggerActive" is set to true. The CDI debugger sets this property when a session is active. The action implementation is actually pretty much agnostic of the debugger, so I think it could be reused for DSF-GDB, provided there is a test whether a DFS-GDB session is active.
Nice find!
Toni, should the org.eclipse.cdt.debug.ui.debuggerActive system property be a count instead of the boolean, so that DSF-GDB as well as other debuggers be able to use it?
(In reply to comment #2) > Toni, should the org.eclipse.cdt.debug.ui.debuggerActive system property be a > count instead of the boolean, so that DSF-GDB as well as other debuggers be > able to use it? I don't think DSF-GDB should use it at all, because it also triggers the visibility of other actions and at least some of them are not (yet) supported by / compatible with DSF-GDB. DSF-GDB could use a different system property or better use a different method of controlling the visibility of the action (e.g. using org.eclipse.ui.menus).
(In reply to comment #0) > The Watch action in the editor is only visible when the system property > "org.eclipse.cdt.debug.ui.debuggerActive" is set to true. Is there a reason it's not always visible? The action could be moved in a new view contribution that does not require an active debug session. It seems natural to me to leave the action visible since there is nothing preventing the user from adding an expression through the Expressions view when there is no debug session active.
(In reply to comment #4) > Is there a reason it's not always visible? I can think of two reasons: 1. This is how the JDT Debugger works 2. The editor context menu is already very cluttered I think we should continue to hide debug actions in the editor context menu unless a debug session is active.
(In reply to comment #5) > (In reply to comment #4) > > Is there a reason it's not always visible? > > I can think of two reasons: > 1. This is how the JDT Debugger works > 2. The editor context menu is already very cluttered > > I think we should continue to hide debug actions in the editor context menu > unless a debug session is active. Ok, thanks.
I have fixed this bug as part of bug 300096. However, I was not able to use the existing org.eclipse.cdt.debug.ui.debuggerActive but instead I had to copy the code that set/unset it and create a new system property org.eclipse.cdt.dsf.gdb.ui.debuggerActive. The reason I couldn't re-use it is that the class that sets/unsets it (EvaluationContextManager) needs the selection to be adaptable to ICDebugTarget. I wanted to also check for the selection to be an IDMVMNode, but of course, I can't do that in cdt.debug.ui, so I had to copy that code to cdt.dsf.gdb.ui. If you guys have a way to re-use the class for both debugger integration, that would be great. If not, then it may be worth moving the new EvaluationContextManager to DSF itself, so as to all others to use that visibility trick.