|
Lines 10-20
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.cdt.dsf.gdb.service; |
11 |
package org.eclipse.cdt.dsf.gdb.service; |
| 12 |
|
12 |
|
|
|
13 |
import java.util.Map; |
| 14 |
import java.util.Properties; |
| 15 |
|
| 16 |
import org.eclipse.cdt.debug.core.CDebugUtils; |
| 17 |
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; |
| 13 |
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; |
18 |
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; |
|
|
19 |
import org.eclipse.cdt.dsf.concurrent.ImmediateExecutor; |
| 20 |
import org.eclipse.cdt.dsf.concurrent.ReflectionSequence; |
| 14 |
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; |
21 |
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; |
|
|
22 |
import org.eclipse.cdt.dsf.concurrent.Sequence; |
| 15 |
import org.eclipse.cdt.dsf.datamodel.DMContexts; |
23 |
import org.eclipse.cdt.dsf.datamodel.DMContexts; |
| 16 |
import org.eclipse.cdt.dsf.datamodel.IDMContext; |
24 |
import org.eclipse.cdt.dsf.datamodel.IDMContext; |
|
|
25 |
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; |
| 26 |
import org.eclipse.cdt.dsf.debug.service.command.ICommand; |
| 17 |
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; |
27 |
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; |
|
|
28 |
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; |
| 18 |
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; |
29 |
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; |
| 19 |
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; |
30 |
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl; |
| 20 |
import org.eclipse.cdt.dsf.mi.service.IMICommandControl; |
31 |
import org.eclipse.cdt.dsf.mi.service.IMICommandControl; |
|
Lines 22-41
Link Here
|
| 22 |
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext; |
33 |
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext; |
| 23 |
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; |
34 |
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; |
| 24 |
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo; |
35 |
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo; |
|
|
36 |
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; |
| 37 |
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakpoint; |
| 25 |
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; |
38 |
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; |
| 26 |
import org.eclipse.cdt.dsf.service.DsfSession; |
39 |
import org.eclipse.cdt.dsf.service.DsfSession; |
|
|
40 |
import org.eclipse.core.runtime.CoreException; |
| 27 |
import org.eclipse.core.runtime.IStatus; |
41 |
import org.eclipse.core.runtime.IStatus; |
| 28 |
import org.eclipse.core.runtime.Status; |
42 |
import org.eclipse.core.runtime.Status; |
| 29 |
|
43 |
|
| 30 |
/** |
44 |
/** |
| 31 |
* Adding support for multi-process with GDB 7.2 |
|
|
| 32 |
* |
| 33 |
* @since 4.0 |
45 |
* @since 4.0 |
| 34 |
*/ |
46 |
*/ |
| 35 |
public class GDBProcesses_7_2 extends GDBProcesses_7_1 { |
47 |
public class GDBProcesses_7_2 extends GDBProcesses_7_1 { |
| 36 |
|
48 |
|
| 37 |
private CommandFactory fCommandFactory; |
49 |
private CommandFactory fCommandFactory; |
| 38 |
private IGDBControl fCommandControl; |
50 |
private IGDBControl fCommandControl; |
|
|
51 |
private IGDBBackend fBackend; |
| 39 |
|
52 |
|
| 40 |
public GDBProcesses_7_2(DsfSession session) { |
53 |
public GDBProcesses_7_2(DsfSession session) { |
| 41 |
super(session); |
54 |
super(session); |
|
Lines 62-67
Link Here
|
| 62 |
private void doInitialize(RequestMonitor requestMonitor) { |
75 |
private void doInitialize(RequestMonitor requestMonitor) { |
| 63 |
fCommandControl = getServicesTracker().getService(IGDBControl.class); |
76 |
fCommandControl = getServicesTracker().getService(IGDBControl.class); |
| 64 |
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); |
77 |
fCommandFactory = getServicesTracker().getService(IMICommandControl.class).getCommandFactory(); |
|
|
78 |
fBackend = getServicesTracker().getService(IGDBBackend.class); |
| 79 |
|
| 65 |
requestMonitor.done(); |
80 |
requestMonitor.done(); |
| 66 |
} |
81 |
} |
| 67 |
|
82 |
|
|
Lines 69-74
Link Here
|
| 69 |
public void shutdown(RequestMonitor requestMonitor) { |
84 |
public void shutdown(RequestMonitor requestMonitor) { |
| 70 |
super.shutdown(requestMonitor); |
85 |
super.shutdown(requestMonitor); |
| 71 |
} |
86 |
} |
|
|
87 |
|
| 88 |
|
| 89 |
@Override |
| 90 |
protected boolean doIsDebuggerAttachSupported() { |
| 91 |
return true; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
@Override |
| 96 |
protected boolean doCanDetachDebuggerFromProcess() { |
| 97 |
return true; |
| 98 |
} |
| 99 |
|
| 100 |
protected class DebugNewProcessSequence extends ReflectionSequence { |
| 101 |
|
| 102 |
private String fBinaryName; |
| 103 |
private Map<String, Object> fAttributes; |
| 104 |
private IMIContainerDMContext fContainerCtx; |
| 105 |
// Store the dataRM so that we can fill it with the container context that we will be creating |
| 106 |
private DataRequestMonitor<IDMContext> fDataRequestMonitor; |
| 107 |
|
| 108 |
public DebugNewProcessSequence(IDMContext dmc, String file, Map<String, Object> attributes, final DataRequestMonitor<IDMContext> rm) { |
| 109 |
super(GDBProcesses_7_2.this.getExecutor(), rm); |
| 110 |
fBinaryName = file; |
| 111 |
fAttributes = attributes; |
| 112 |
fDataRequestMonitor = rm; |
| 113 |
} |
| 114 |
|
| 115 |
@Override |
| 116 |
protected String[] getExecutionOrder(String group) { |
| 117 |
if (GROUP_TOP_LEVEL.equals(group)) { |
| 118 |
return new String[] { |
| 119 |
"stepAddInferior", //$NON-NLS-1$ |
| 120 |
"stepSetEnvironmentVariables", //$NON-NLS-1$ |
| 121 |
"stepSetExecutable", //$NON-NLS-1$ |
| 122 |
"stepSetArguments", //$NON-NLS-1$ |
| 123 |
"stepStartExecution", //$NON-NLS-1$ |
| 124 |
}; |
| 125 |
} |
| 126 |
return null; |
| 127 |
} |
| 128 |
|
| 129 |
/** |
| 130 |
* Start executing the program. |
| 131 |
*/ |
| 132 |
@Execute |
| 133 |
public void stepAddInferior(final RequestMonitor rm) { |
| 134 |
fCommandControl.queueCommand( |
| 135 |
fCommandFactory.createMIAddInferior(fCommandControl.getContext()), |
| 136 |
new DataRequestMonitor<MIAddInferiorInfo>(ImmediateExecutor.getInstance(), rm) { |
| 137 |
@Override |
| 138 |
protected void handleSuccess() { |
| 139 |
final String groupId = getData().getGroupId(); |
| 140 |
if (groupId == null || groupId.trim().length() == 0) { |
| 141 |
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid gdb group id.", null)); //$NON-NLS-1$ |
| 142 |
rm.done(); |
| 143 |
return; |
| 144 |
} |
| 145 |
|
| 146 |
IProcessDMContext procCtx = createProcessContext(fCommandControl.getContext(), null); |
| 147 |
fContainerCtx = createContainerContext(procCtx, groupId); |
| 148 |
rm.done(); |
| 149 |
} |
| 150 |
}); |
| 151 |
} |
| 152 |
|
| 153 |
/** |
| 154 |
* Specify environment variables if needed |
| 155 |
*/ |
| 156 |
@Execute |
| 157 |
public void stepSetEnvironmentVariables(RequestMonitor rm) { |
| 158 |
boolean clear = false; |
| 159 |
Properties properties = new Properties(); |
| 160 |
try { |
| 161 |
// here we need to pass the proper container context |
| 162 |
clear = fBackend.getClearEnvironment(); |
| 163 |
properties = fBackend.getEnvironmentVariables(); |
| 164 |
} catch (CoreException e) { |
| 165 |
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get environment information", e)); //$NON-NLS-1$ |
| 166 |
rm.done(); |
| 167 |
return; |
| 168 |
} |
| 169 |
|
| 170 |
if (clear == true || properties.size() > 0) { |
| 171 |
// here we need to pass the proper container context |
| 172 |
fCommandControl.setEnvironment(properties, clear, rm); |
| 173 |
} else { |
| 174 |
rm.done(); |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
/** |
| 179 |
* Specify the executable file to be debugged and read the symbol table. |
| 180 |
*/ |
| 181 |
@Execute |
| 182 |
public void stepSetExecutable(RequestMonitor rm) { |
| 183 |
boolean noFileCommand = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP, |
| 184 |
IGDBLaunchConfigurationConstants.DEBUGGER_USE_SOLIB_SYMBOLS_FOR_APP_DEFAULT); |
| 185 |
|
| 186 |
if (!noFileCommand && fBinaryName != null && fBinaryName.length() > 0) { |
| 187 |
fCommandControl.queueCommand( |
| 188 |
fCommandFactory.createMIFileExecAndSymbols(fContainerCtx, fBinaryName), |
| 189 |
new DataRequestMonitor<MIInfo>(getExecutor(), rm)); |
| 190 |
} else { |
| 191 |
rm.done(); |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
/** |
| 196 |
* Specify the arguments to the executable file. |
| 197 |
*/ |
| 198 |
@Execute |
| 199 |
public void stepSetArguments(RequestMonitor rm) { |
| 200 |
try { |
| 201 |
String args = fBackend.getProgramArguments(); |
| 202 |
|
| 203 |
if (args != null) { |
| 204 |
fCommandControl.queueCommand( |
| 205 |
// here we need to pass the proper container context |
| 206 |
fCommandFactory.createMIGDBSetArgs(fCommandControl.getContext(), args), |
| 207 |
new DataRequestMonitor<MIInfo>(getExecutor(), rm)); |
| 208 |
} else { |
| 209 |
rm.done(); |
| 210 |
} |
| 211 |
} catch (CoreException e) { |
| 212 |
rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot get inferior arguments", e)); //$NON-NLS-1$ |
| 213 |
rm.done(); |
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
/** |
| 218 |
* Start executing the program. |
| 219 |
*/ |
| 220 |
@Execute |
| 221 |
public void stepStartExecution(final RequestMonitor rm) { |
| 222 |
startOrRestart(fContainerCtx, fAttributes, false, new DataRequestMonitor<IMIContainerDMContext>(ImmediateExecutor.getInstance(), rm) { |
| 223 |
@Override |
| 224 |
protected void handleSuccess() { |
| 225 |
// Set the container that we created |
| 226 |
fDataRequestMonitor.setData(getData()); |
| 227 |
|
| 228 |
// Don't call fDataRequestMonitor.done(), the sequence will |
| 229 |
// automatically do that when we call rm.done(); |
| 230 |
rm.done(); |
| 231 |
} |
| 232 |
}); |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
@Override |
| 237 |
public void debugNewProcess(IDMContext dmc, String file, |
| 238 |
Map<String, Object> attributes, DataRequestMonitor<IDMContext> rm) { |
| 239 |
Sequence debugNewProcess = new DebugNewProcessSequence(dmc, file, attributes, rm); |
| 240 |
ImmediateExecutor.getInstance().execute(debugNewProcess); |
| 241 |
} |
| 72 |
|
242 |
|
| 73 |
@Override |
243 |
@Override |
| 74 |
public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> rm) { |
244 |
public void attachDebuggerToProcess(final IProcessDMContext procCtx, final DataRequestMonitor<IDMContext> rm) { |
|
Lines 150-154
Link Here
|
| 150 |
rm.done(); |
320 |
rm.done(); |
| 151 |
} |
321 |
} |
| 152 |
} |
322 |
} |
|
|
323 |
|
| 324 |
protected class StartOrRestartProcessSequence extends ReflectionSequence { |
| 325 |
|
| 326 |
// This variable will be used to store the original container context, |
| 327 |
// but once the new process is start (restarted), it will contain the new |
| 328 |
// container context. This new container context has for parent the process |
| 329 |
// context, which holds the new pid. |
| 330 |
private IMIContainerDMContext fContainerDmc; |
| 331 |
|
| 332 |
private MIBreakpoint fUserBreakpoint = null; |
| 333 |
private boolean fUserBreakpointIsOnMain = false; |
| 334 |
private boolean fReverseEnabled; |
| 335 |
private boolean fRestart; |
| 336 |
private Map<String, Object> fAttributes; |
| 337 |
// Store the dataRM so that we can fill it with the container context that we will be creating |
| 338 |
private DataRequestMonitor<IMIContainerDMContext> fDataRequestMonitor; |
| 339 |
|
| 340 |
public StartOrRestartProcessSequence(IMIContainerDMContext containerDmc, Map<String, Object> attributes, |
| 341 |
boolean restart, DataRequestMonitor<IMIContainerDMContext> rm) { |
| 342 |
super(GDBProcesses_7_2.this.getExecutor(), rm); |
| 343 |
fContainerDmc = containerDmc; |
| 344 |
fAttributes = attributes; |
| 345 |
fRestart = restart; |
| 346 |
fDataRequestMonitor = rm; |
| 347 |
fReverseEnabled = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
| 348 |
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); |
| 349 |
} |
| 350 |
|
| 351 |
@Override |
| 352 |
protected String[] getExecutionOrder(String group) { |
| 353 |
if (GROUP_TOP_LEVEL.equals(group)) { |
| 354 |
return new String[] { |
| 355 |
"stepInsertStopOnMainBreakpoint", //$NON-NLS-1$ |
| 356 |
"stepSetBreakpointForReverse", //$NON-NLS-1$ |
| 357 |
"stepRunProgram", //$NON-NLS-1$ |
| 358 |
"stepSetReverseOff", //$NON-NLS-1$ |
| 359 |
"stepEnableReverse", //$NON-NLS-1$ |
| 360 |
"stepContinue", //$NON-NLS-1$ |
| 361 |
}; |
| 362 |
} |
| 363 |
return null; |
| 364 |
} |
| 365 |
|
| 366 |
/** |
| 367 |
* If the user requested a 'stopOnMain', let's set the temporary breakpoint |
| 368 |
* where the user specified. |
| 369 |
*/ |
| 370 |
@Execute |
| 371 |
public void stepInsertStopOnMainBreakpoint(final RequestMonitor rm) { |
| 372 |
boolean userRequestedStop = CDebugUtils.getAttribute(fAttributes, |
| 373 |
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, |
| 374 |
false); |
| 375 |
|
| 376 |
if (userRequestedStop) { |
| 377 |
String userStopSymbol = CDebugUtils.getAttribute(fAttributes, |
| 378 |
ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, |
| 379 |
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT); |
| 380 |
|
| 381 |
fCommandControl.queueCommand( |
| 382 |
fCommandFactory.createMIBreakInsert((IBreakpointsTargetDMContext)fCommandControl.getContext(), |
| 383 |
true, false, null, 0, userStopSymbol, 0), |
| 384 |
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) { |
| 385 |
@Override |
| 386 |
public void handleSuccess() { |
| 387 |
if (getData() != null) { |
| 388 |
MIBreakpoint[] breakpoints = getData().getMIBreakpoints(); |
| 389 |
if (breakpoints.length > 0) { |
| 390 |
fUserBreakpoint = breakpoints[0]; |
| 391 |
} |
| 392 |
} |
| 393 |
rm.done(); |
| 394 |
} |
| 395 |
}); |
| 396 |
} else { |
| 397 |
rm.done(); |
| 398 |
} |
| 399 |
} |
| 400 |
|
| 401 |
/* |
| 402 |
* If reverse debugging, set a breakpoint on main to be able to enable reverse |
| 403 |
* as early as possible. |
| 404 |
* If the user has requested a stop at the same point, we could skip this breakpoint |
| 405 |
* however, we have to first set it to find out! So, we just leave it. |
| 406 |
*/ |
| 407 |
@Execute |
| 408 |
public void stepSetBreakpointForReverse(final RequestMonitor rm) { |
| 409 |
if (fReverseEnabled) { |
| 410 |
fCommandControl.queueCommand( |
| 411 |
fCommandFactory.createMIBreakInsert((IBreakpointsTargetDMContext)fCommandControl.getContext(), |
| 412 |
true, false, null, 0, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT, 0), |
| 413 |
new DataRequestMonitor<MIBreakInsertInfo>(getExecutor(), rm) { |
| 414 |
@Override |
| 415 |
public void handleSuccess() { |
| 416 |
if (getData() != null) { |
| 417 |
MIBreakpoint[] breakpoints = getData().getMIBreakpoints(); |
| 418 |
if (breakpoints.length > 0 && fUserBreakpoint != null) { |
| 419 |
fUserBreakpointIsOnMain = breakpoints[0].getAddress().equals(fUserBreakpoint.getAddress()); |
| 420 |
} |
| 421 |
} |
| 422 |
rm.done(); |
| 423 |
} |
| 424 |
}); |
| 425 |
} else { |
| 426 |
rm.done(); |
| 427 |
} |
| 428 |
} |
| 429 |
/* |
| 430 |
* Now, run the program. Use either -exec-run or -exec-continue depending |
| 431 |
* on whether we have remote session or not. |
| 432 |
*/ |
| 433 |
@Execute |
| 434 |
public void stepRunProgram(final RequestMonitor rm) { |
| 435 |
ICommand<MIInfo> command; |
| 436 |
if (useContinueCommand(fAttributes, fRestart)) { |
| 437 |
command = fCommandFactory.createMIExecContinue(fContainerDmc); |
| 438 |
} else { |
| 439 |
command = fCommandFactory.createMIExecRun(fContainerDmc); |
| 440 |
} |
| 441 |
fCommandControl.queueCommand(command, new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm) { |
| 442 |
@Override |
| 443 |
protected void handleSuccess() { |
| 444 |
// Now that the process is started, the pid has been allocated |
| 445 |
// so we need to fetch the proper container context |
| 446 |
// We replace our current context which does not have the pid, with one that has the pid. |
| 447 |
fContainerDmc = createContainerContextFromGroupId(fCommandControl.getContext(), fContainerDmc.getGroupId()); |
| 448 |
fDataRequestMonitor.setData(fContainerDmc); |
| 449 |
rm.done(); |
| 450 |
} |
| 451 |
}); |
| 452 |
|
| 453 |
} |
| 454 |
/* |
| 455 |
* In case of a restart, reverse debugging should be marked as off here because |
| 456 |
* GDB will have turned it off. We may turn it back on after. |
| 457 |
*/ |
| 458 |
@Execute |
| 459 |
public void stepSetReverseOff(RequestMonitor rm) { |
| 460 |
// Although it only makes sense for a restart, it doesn't hurt |
| 461 |
// do to it all the time. |
| 462 |
GDBRunControl_7_0 reverseService = getServicesTracker().getService(GDBRunControl_7_0.class); |
| 463 |
if (reverseService != null) { |
| 464 |
reverseService.setReverseModeEnabled(false); |
| 465 |
} |
| 466 |
rm.done(); |
| 467 |
} |
| 468 |
/* |
| 469 |
* Since we have started the program, we can turn on reverse debugging if needed |
| 470 |
*/ |
| 471 |
@Execute |
| 472 |
public void stepEnableReverse(RequestMonitor rm) { |
| 473 |
if (fReverseEnabled) { |
| 474 |
IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class); |
| 475 |
if (reverseService != null) { |
| 476 |
reverseService.enableReverseMode(fCommandControl.getContext(), true, rm); |
| 477 |
return; |
| 478 |
} |
| 479 |
} |
| 480 |
rm.done(); |
| 481 |
} |
| 482 |
/* |
| 483 |
* Finally, if we are enabling reverse, and the userSymbolStop is not on main, |
| 484 |
* we should do a continue because we are currently stopped on main but that |
| 485 |
* is not what the user requested |
| 486 |
*/ |
| 487 |
@Execute |
| 488 |
public void stepContinue(RequestMonitor rm) { |
| 489 |
if (fReverseEnabled && !fUserBreakpointIsOnMain) { |
| 490 |
fCommandControl.queueCommand(fCommandFactory.createMIExecContinue(fContainerDmc), |
| 491 |
new DataRequestMonitor<MIInfo>(getExecutor(), rm)); |
| 492 |
} else { |
| 493 |
rm.done(); |
| 494 |
} |
| 495 |
} |
| 496 |
}; |
| 497 |
|
| 498 |
/** |
| 499 |
* Insert breakpoint at entry if set, and start or restart the program. |
| 500 |
* Note that restart does not apply to remote or attach sessions. |
| 501 |
* |
| 502 |
* If we want to enable Reverse debugging from the start of the program we do the following: |
| 503 |
* attachSession => enable reverse |
| 504 |
* else => set temp bp on main, run, enable reverse, continue if bp on main was not requested by user |
| 505 |
*/ |
| 506 |
protected void startOrRestart(IMIContainerDMContext containerDmc, Map<String, Object> attributes, boolean restart, DataRequestMonitor<IMIContainerDMContext> rm) { |
| 507 |
final boolean reverseEnabled = CDebugUtils.getAttribute(attributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
| 508 |
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); |
| 509 |
|
| 510 |
if (fBackend.getIsAttachSession()) { |
| 511 |
// Restart does not apply to attach sessions. |
| 512 |
// |
| 513 |
// When attaching to a running process, we do not need to set a breakpoint or |
| 514 |
// start the program; it is left up to the user. |
| 515 |
// We only need to turn on Reverse Debugging if requested. |
| 516 |
if (reverseEnabled) { |
| 517 |
IReverseRunControl reverseService = getServicesTracker().getService(IReverseRunControl.class); |
| 518 |
if (reverseService != null) { |
| 519 |
reverseService.enableReverseMode(fCommandControl.getContext(), true, rm); |
| 520 |
return; |
| 521 |
} |
| 522 |
} |
| 523 |
//TODO khouzam must set rm.setdata() |
| 524 |
rm.done(); |
| 525 |
return; |
| 526 |
} |
| 527 |
|
| 528 |
// When it is not an attach session, it gets a little more complicated |
| 529 |
// so let's use a sequence. |
| 530 |
ImmediateExecutor.getInstance().execute(new StartOrRestartProcessSequence(containerDmc, attributes, restart, rm)); |
| 531 |
} |
| 532 |
|
| 533 |
/** |
| 534 |
* This method indicates if we should use the -exec-continue method |
| 535 |
* instead of the -exec-run method. |
| 536 |
* This can be overridden to allow for customization. |
| 537 |
*/ |
| 538 |
protected boolean useContinueCommand(Map<String, Object> attributes, boolean restart) { |
| 539 |
// When doing remote debugging, we use -exec-continue instead of -exec-run |
| 540 |
// Restart does not apply to remote sessions |
| 541 |
return fBackend.getSessionType() == SessionType.REMOTE; |
| 542 |
} |
| 153 |
} |
543 |
} |
| 154 |
|
544 |
|