|
Lines 34-41
Link Here
|
| 34 |
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.ProcessPrompter.PrompterInfo; |
34 |
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.ProcessPrompter.PrompterInfo; |
| 35 |
import org.eclipse.cdt.dsf.gdb.launching.IProcessExtendedInfo; |
35 |
import org.eclipse.cdt.dsf.gdb.launching.IProcessExtendedInfo; |
| 36 |
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages; |
36 |
import org.eclipse.cdt.dsf.gdb.launching.LaunchMessages; |
|
|
37 |
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend; |
| 38 |
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses; |
| 37 |
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData; |
39 |
import org.eclipse.cdt.dsf.gdb.service.IGDBProcesses.IGdbThreadDMData; |
| 38 |
import org.eclipse.cdt.dsf.mi.service.IMIProcesses; |
40 |
import org.eclipse.cdt.dsf.gdb.service.SessionType; |
| 39 |
import org.eclipse.cdt.dsf.service.DsfServicesTracker; |
41 |
import org.eclipse.cdt.dsf.service.DsfServicesTracker; |
| 40 |
import org.eclipse.cdt.dsf.service.DsfSession; |
42 |
import org.eclipse.cdt.dsf.service.DsfSession; |
| 41 |
import org.eclipse.core.runtime.CoreException; |
43 |
import org.eclipse.core.runtime.CoreException; |
|
Lines 45-50
Link Here
|
| 45 |
import org.eclipse.core.runtime.jobs.Job; |
47 |
import org.eclipse.core.runtime.jobs.Job; |
| 46 |
import org.eclipse.debug.core.DebugPlugin; |
48 |
import org.eclipse.debug.core.DebugPlugin; |
| 47 |
import org.eclipse.debug.core.IStatusHandler; |
49 |
import org.eclipse.debug.core.IStatusHandler; |
|
|
50 |
import org.eclipse.swt.SWT; |
| 51 |
import org.eclipse.swt.widgets.Display; |
| 52 |
import org.eclipse.swt.widgets.FileDialog; |
| 53 |
import org.eclipse.swt.widgets.Shell; |
| 54 |
import org.eclipse.ui.PlatformUI; |
| 48 |
|
55 |
|
| 49 |
public class GdbConnectCommand implements IConnect { |
56 |
public class GdbConnectCommand implements IConnect { |
| 50 |
|
57 |
|
|
Lines 181-187
Link Here
|
| 181 |
@Override |
188 |
@Override |
| 182 |
protected void handleSuccess() { |
189 |
protected void handleSuccess() { |
| 183 |
// New cycle, look for service again |
190 |
// New cycle, look for service again |
| 184 |
final IMIProcesses procService = fTracker.getService(IMIProcesses.class); |
191 |
final IGDBProcesses procService = fTracker.getService(IGDBProcesses.class); |
| 185 |
if (procService != null) { |
192 |
if (procService != null) { |
| 186 |
Object data = getData(); |
193 |
Object data = getData(); |
| 187 |
if (data instanceof String) { |
194 |
if (data instanceof String) { |
|
Lines 192-200
Link Here
|
| 192 |
// khouzam, maybe we should at least pass stopOnMain? |
199 |
// khouzam, maybe we should at least pass stopOnMain? |
| 193 |
new HashMap<String, Object>(), new DataRequestMonitor<IDMContext>(fExecutor, rm)); |
200 |
new HashMap<String, Object>(), new DataRequestMonitor<IDMContext>(fExecutor, rm)); |
| 194 |
} else if (data instanceof Integer) { |
201 |
} else if (data instanceof Integer) { |
|
|
202 |
final String[] binaryPath = new String[1]; |
| 203 |
binaryPath[0] = null; |
| 204 |
final IGDBBackend backend = fTracker.getService(IGDBBackend.class); |
| 205 |
if (backend != null && backend.getSessionType() == SessionType.REMOTE) { |
| 206 |
// For remote attach, we must set the binary first |
| 207 |
// For a local attach, GDB can figure out the binary automatically, |
| 208 |
// so we don't specify it. |
| 209 |
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { |
| 210 |
public void run() { |
| 211 |
Shell shell = Display.getCurrent().getActiveShell(); |
| 212 |
if (shell != null) { |
| 213 |
FileDialog fd = new FileDialog(shell, SWT.NONE); |
| 214 |
binaryPath[0] = fd.open(); |
| 215 |
} |
| 216 |
} |
| 217 |
}); |
| 218 |
} |
| 219 |
|
| 195 |
IProcessDMContext procDmc = procService.createProcessContext(controlCtx, |
220 |
IProcessDMContext procDmc = procService.createProcessContext(controlCtx, |
| 196 |
Integer.toString((Integer)getData())); |
221 |
Integer.toString((Integer)getData())); |
| 197 |
procService.attachDebuggerToProcess(procDmc, new DataRequestMonitor<IDMContext>(fExecutor, rm)); |
222 |
procService.attachDebuggerToProcess(procDmc, binaryPath[0], new DataRequestMonitor<IDMContext>(fExecutor, rm)); |
| 198 |
} else { |
223 |
} else { |
| 199 |
rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid return type for process prompter", null)); //$NON-NLS-1$ |
224 |
rm.setStatus(new Status(IStatus.ERROR, GdbUIPlugin.PLUGIN_ID, IDsfStatusConstants.INTERNAL_ERROR, "Invalid return type for process prompter", null)); //$NON-NLS-1$ |
| 200 |
rm.done(); |
225 |
rm.done(); |