mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 333284: Thread state is shown incorrectly after attaching to an app in non-stop mode. Use non-interrupting attach when in non-stop to fix this issue, and to improved behavior when attaching.
This commit is contained in:
parent
35255ca2cc
commit
98194b097c
4 changed files with 41 additions and 4 deletions
|
@ -59,6 +59,7 @@ import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
|
|||
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||
|
@ -840,8 +841,16 @@ public class GDBProcesses_7_0 extends AbstractDsfService
|
|||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
// For non-stop mode, we do a non-interrupting attach
|
||||
// Bug 333284
|
||||
boolean shouldInterrupt = true;
|
||||
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
|
||||
if (runControl != null && runControl.getRunMode() == MIRunMode.NON_STOP) {
|
||||
shouldInterrupt = false;
|
||||
}
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
fCommandFactory.createMITargetAttach(fContainerDmc, ((IMIProcessDMContext)procCtx).getProcId()),
|
||||
fCommandFactory.createMITargetAttach(fContainerDmc, ((IMIProcessDMContext)procCtx).getProcId(), shouldInterrupt),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), rm));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -27,8 +27,10 @@ import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
|
|||
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
|
||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
||||
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
|
||||
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
|
||||
|
@ -179,8 +181,16 @@ public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
|
|||
new Step() {
|
||||
@Override
|
||||
public void execute(RequestMonitor rm) {
|
||||
fCommandControl.queueCommand(
|
||||
fCommandFactory.createMITargetAttach(fContainerDmc, ((IMIProcessDMContext)procCtx).getProcId()),
|
||||
// For non-stop mode, we do a non-interrupting attach
|
||||
// Bug 333284
|
||||
boolean shouldInterrupt = true;
|
||||
IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class);
|
||||
if (runControl != null && runControl.getRunMode() == MIRunMode.NON_STOP) {
|
||||
shouldInterrupt = false;
|
||||
}
|
||||
|
||||
fCommandControl.queueCommand(
|
||||
fCommandFactory.createMITargetAttach(fContainerDmc, ((IMIProcessDMContext)procCtx).getProcId(), shouldInterrupt),
|
||||
new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -715,6 +715,11 @@ public class CommandFactory {
|
|||
return new MITargetAttach(ctx, groupId);
|
||||
}
|
||||
|
||||
/** @since 4.0 */
|
||||
public ICommand<MIInfo> createMITargetAttach(IMIContainerDMContext ctx, String groupId, boolean interrupt) {
|
||||
return new MITargetAttach(ctx, groupId, interrupt);
|
||||
}
|
||||
|
||||
public ICommand<MIInfo> createMITargetDetach(ICommandControlDMContext ctx, String groupId) {
|
||||
return new MITargetDetach(ctx, groupId);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,19 @@ public class MITargetAttach extends MICommand<MIInfo> {
|
|||
* @since 4.0
|
||||
*/
|
||||
public MITargetAttach(IMIContainerDMContext ctx, String pid) {
|
||||
super(ctx, "-target-attach", new String[] { pid }); //$NON-NLS-1$
|
||||
this(ctx, pid, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ctx indicates which inferior should be used when doing the attach
|
||||
* @param id the pid of the process to attach to
|
||||
* @param interrupt indicates if the process should be interrupted once the attach is done
|
||||
* Leaving the process running is only support with target-async on, which
|
||||
* we currently only use in non-stop mode
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public MITargetAttach(IMIContainerDMContext ctx, String pid, boolean interrupt) {
|
||||
super(ctx, "-target-attach", new String[] { pid, interrupt ? "" : "&" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue