diff options
author | Uwe Stieber | 2015-05-21 16:26:37 +0000 |
---|---|---|
committer | Uwe Stieber | 2015-05-21 16:26:37 +0000 |
commit | d0b1bd3213d033469d67de1d885406e8777e1f7b (patch) | |
tree | 238a9ec927980b02fa1ad57d4da1ede6cae163cd /target_explorer | |
parent | da777d74317b0cb192239474c4a6e9d8a026969a (diff) | |
download | org.eclipse.tcf-d0b1bd3213d033469d67de1d885406e8777e1f7b.tar.gz org.eclipse.tcf-d0b1bd3213d033469d67de1d885406e8777e1f7b.tar.xz org.eclipse.tcf-d0b1bd3213d033469d67de1d885406e8777e1f7b.zip |
Target Explorer: Add symbol-file in attach to application case
Diffstat (limited to 'target_explorer')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java index a7f003ad9..715b0cbca 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.cdt/src/org/eclipse/tcf/te/tcf/launch/cdt/launching/TEGdbAbstractLaunchDelegate.java @@ -15,11 +15,21 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.DsfExecutor; import org.eclipse.cdt.dsf.concurrent.DsfRunnable; +import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor; import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.cdt.dsf.datamodel.IDMContext; import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch; import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate; +import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; +import org.eclipse.cdt.dsf.mi.service.IMICommandControl; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; +import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; @@ -207,7 +217,7 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate { shutdownSession(l, gdbServerOutput.toString()); } - // 3. Let debugger know how gdbserver was started on the remote + // Let debugger know how gdbserver was started on the remote ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP, true); wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST, TEHelper.getCurrentConnection(config).getPeer().getAttributes().get(IPeer.ATTR_IP_HOST)); @@ -227,6 +237,40 @@ public abstract class TEGdbAbstractLaunchDelegate extends GdbLaunchDelegate { } } + /* (non-Javadoc) + * @see org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate#launchDebugSession(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected void launchDebugSession(ILaunchConfiguration config, ILaunch l, IProgressMonitor monitor) throws CoreException { + super.launchDebugSession(config, l, monitor); + + // Determine if the launch is an attach launch + final boolean isAttachLaunch = ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH.equals(config.getType().getIdentifier()); + if (!isAttachLaunch) return; + + final IPath exePath = checkBinaryDetails(config); + + if (l instanceof GdbLaunch && exePath != null) { + final GdbLaunch launch = (GdbLaunch) l; + final DsfExecutor executor = launch.getDsfExecutor(); + final DsfServicesTracker tracker = new DsfServicesTracker(Activator.getDefault().getBundle().getBundleContext(), launch.getSession().getId()); + + final RequestMonitor rm = new DataRequestMonitor<IDMContext>(executor, null); + + executor.execute(new DsfRunnable() { + @Override + public void run() { + IGDBControl commandControl = tracker.getService(IGDBControl.class); + CommandFactory commandFactory = tracker.getService(IMICommandControl.class).getCommandFactory(); + + commandControl.queueCommand( + commandFactory.createMIFileSymbolFile(commandControl.getContext(), exePath.toString()), + new ImmediateDataRequestMonitor<MIInfo>(rm)); + } + }); + } + } + /** * Shutdown the GDB debug session. * |