Community
Participate
Working Groups
Build Identifier: Build id: M20090917-0800 Version: 3.5.1 Build id: M20090917-0800 DSF Debugger "disconnect" button is inactive for none "attach-type" sessions even if "detach" command is supported by GDB. This button may be usefull even if GDB is not regarded to be attached, yet it can make the remote gdbserver detach from the process. In case of DEBUGGER_MODE_RUN "connect" and "disconnect" buttons are active, this is for example when debugging local C/C++ application in DSF. If DEBUGGER_MODE_REMOTE is used these buttons are inactive. If for example DEBUGGER_MODE_REMOTE_ATTACH is used then "connect" and "disconnect" buttons are also active but "step-in","step-over"... are not active till user pressed "connect" and entered the process id. But if gdbserver is already running and already connected to the process then it also won't work Reproducible: Always Steps to Reproduce: 1.Run DSF GDB launch delegate (in custom plug-in for example) DEBUGGER_MODE_REMOTE 2. run gdbserver and make it start the process 3. setup claunch configuration for DSF launcher so that it connects to the gdbserver
org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate creates session basing on the sessionType private void launchDebugSession( final ILaunchConfiguration config, ILaunch l, IProgressMonitor monitor ) throws CoreException { if ( monitor.isCanceled() ) { return; } SessionType sessionType = LaunchUtils.getSessionType(config); boolean attach = LaunchUtils.getIsAttach(config); ... org.eclipse.cdt.dsf.gdb.launching.LaunchUtils function getSessionType returns if session "is attach" or not basing on this: public static boolean getIsAttach(ILaunchConfiguration config) { boolean ret = false; String debugMode = null; try { debugMode = config.getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN ); if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN)) { ret = false; } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH)) { ret = true; } else if (debugMode.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE)) { ret = false; } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE)) { ret = false; //ret = true;System.out.println("org.eclipse.cdt.dfs.gdb.LaunchUtils.getIsAttach(): forcing ret="+ret); } else if (debugMode.equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH)) { ret = true; } } catch (CoreException e) { } (new Exception("org.eclipse.cdt.dfs.gdb.LaunchUtils.getIsAttach(): debugMode="+debugMode+" ret="+ret)).printStackTrace(); return ret; } org.eclipse.cdt.dsf.gdb.launching.LaunchUtils.getSessionType() is used in: [1]org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate.launchDebugSession() [2]org.eclipse.cdt.dsf.gdb.service.GDBBackend.getIsAttachSession() Basing on return value of [2] commands/buttons org.eclipse.cdt.dsf.gdb and org.eclipse.cdt.dsf.gdb.service are determining their enable/disable state. So that if session is "attach-type" then at the very beginning only "connect" and "disconnect" buttons are active (all other "step-in","step-over" buttons are inactive) and user have to use "connect" button and specify the number of process to attach. And if our remote gdbserver is already attached to process we can do nothing with it. If session is NOT "attach-type", then "connect" and "disconnect" buttons are always inactive.
This feature may be enhancement ...
Created attachment 194723 [details] Potential fix I think this patch would fix things. I will need to do more testing though.
GDB accepts the 'detach' command in every scenario that we use, even in post-mortem debugging. Although it is a little weird to disconnect when in post-mortem mode, I left it since GDB supports it and people may find a use for it. Committed to HEAD. (In reply to comment #0) > If for example DEBUGGER_MODE_REMOTE_ATTACH is used then "connect" and > "disconnect" buttons are also active but "step-in","step-over"... are not > active till user pressed "connect" and entered the process id. > But if gdbserver is already running and already connected to the process > then it also won't work It is not clear to me if this is another problem or not. The fix that I did was mostly based on the title of the bug which states that the 'disconnect' button is not enabled when it should be.
*** cdt cvs genie on behalf of mkhouzam *** Bug 306552: DSF Debugger "disconnect" button is inactive for non-attach sessions even if "detach" command is supported by GDB. [*] GDBProcesses.java 1.25 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java?root=Tools_Project&r1=1.24&r2=1.25 [*] GDBProcesses_7_0.java 1.51 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java?root=Tools_Project&r1=1.50&r2=1.51