1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[254528] - [update policy][run control] "Wait for views to update after every step" does not work reliably.

This commit is contained in:
Pawel Piech 2008-11-12 21:42:58 +00:00
parent 06d745b184
commit 34eb5e6986
5 changed files with 44 additions and 11 deletions

View file

@ -73,7 +73,7 @@ public final class SteppingController implements IStepQueueManager
* stepping is enabled. This also serves as a safeguard in the case stepping
* control participants fail to indicate completion of event processing.
*/
public final static int MAX_STEP_DELAY= 1000;
public final static int MAX_STEP_DELAY= 5000;
private final static boolean DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.dd.dsf.debug.ui/stepping")); //$NON-NLS-1$ //$NON-NLS-2$
@ -216,6 +216,7 @@ public final class SteppingController implements IStepQueueManager
* @param execCtx
*/
public void doneStepping(final IExecutionDMContext execCtx, final ISteppingControlParticipant participant) {
if (DEBUG) System.out.println("[SteppingController] doneStepping participant=" + participant.getClass().getSimpleName()); //$NON-NLS-1$
List<ISteppingControlParticipant> participants = fStepInProgress.get(execCtx);
if (participants != null) {
participants.remove(participant);
@ -285,7 +286,9 @@ public final class SteppingController implements IStepQueueManager
* @return <code>true</code> if the step should be delayed
*/
private boolean shouldDelayStep(IExecutionDMContext execCtx) {
return getStepDelay(execCtx) > 0;
final int stepDelay= getStepDelay(execCtx);
if (DEBUG) System.out.println("[SteppingController] shouldDelayStep delay=" + stepDelay); //$NON-NLS-1$
return stepDelay > 0;
}
/**
@ -345,6 +348,7 @@ public final class SteppingController implements IStepQueueManager
* @param stepType Type of step to execute.
*/
public void enqueueStep(final IExecutionDMContext execCtx, final StepType stepType) {
System.out.println("[SteppingController] enqueueStep ctx=" + execCtx); //$NON-NLS-1$
if (!shouldDelayStep(execCtx) || doCanEnqueueStep(execCtx, stepType)) {
doEnqueueStep(execCtx, stepType);
processStepQueue(execCtx);
@ -415,6 +419,7 @@ public final class SteppingController implements IStepQueueManager
return;
}
final StepRequest request = queue.get(0);
if (DEBUG) System.out.println("[SteppingController] processStepQueue request-in-progress="+request.inProgress); //$NON-NLS-1$
if (!request.inProgress) {
if (isSteppingDisabled(request.fContext)) {
return;
@ -502,6 +507,7 @@ public final class SteppingController implements IStepQueueManager
long now = System.currentTimeMillis();
long lastStepTime = getLastStepTime(execCtx);
if (now - lastStepTime > MAX_STEP_DELAY) {
if (DEBUG) System.out.println("[SteppingController] stepping control participant(s) timed out"); //$NON-NLS-1$
enableStepping(execCtx);
disabled = false;
}

View file

@ -185,7 +185,16 @@ public class ExpressionManagerVMNode extends AbstractVMNode
final CountingRequestMonitor multiRm = new ViewerCountingRequestMonitor(getVMProvider().getExecutor(), update);
int multiRmCount = 0;
for (int i = update.getOffset(); i < update.getOffset() + update.getLength() && i < expressions.length + 1; i++) {
int lowOffset= update.getOffset();
if (lowOffset < 0) {
lowOffset = 0;
}
int length= update.getLength();
if (length <= 0) {
length = expressions.length;
}
final int highOffset= lowOffset + length;
for (int i = lowOffset; i < highOffset && i < expressions.length + 1; i++) {
if (i < expressions.length) {
multiRmCount++;
final int childIndex = i;

View file

@ -3,3 +3,4 @@ org.eclipse.dd.dsf.ui/debug/vm/contentProvider = false
org.eclipse.dd.dsf.ui/debug/vm/delta = false
org.eclipse.dd.dsf.ui/debug/vm/cache = false
org.eclipse.dd.dsf.ui/debug/vm/presentationId =
org.eclipse.dd.dsf.ui/debug/vm/atomicUpdate = false

View file

@ -18,13 +18,16 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.dd.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfExecutor;
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
import org.eclipse.dd.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData;
@ -986,11 +989,16 @@ public class AbstractCachingVMProvider extends AbstractVMProvider implements ICa
getModelDataFromService(node, update, service, dmc, rm, executor, entry );
}
else {
try {
dsfExecutor.execute(new DsfRunnable() {
public void run() {
getModelDataFromService(node, update, service, dmc, rm, executor, entry );
}
});
} catch (RejectedExecutionException e) {
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_STATE, "Service session's executor shut down.", null)); //$NON-NLS-1$
rm.done();
}
}
}
}

View file

@ -17,6 +17,7 @@ import java.util.concurrent.RejectedExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.dd.dsf.concurrent.CountingRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
@ -39,6 +40,9 @@ import org.eclipse.swt.graphics.RGB;
@SuppressWarnings("restriction")
class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
private static final boolean DEBUG = Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.dd.dsf.ui/debug/vm/atomicUpdate")); //$NON-NLS-1$ //;
private static final class UpdateLevel {
private final List<Object> fChildren;
private final TreePath fPath;
@ -135,8 +139,9 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
fRequestMonitor = new CountingRequestMonitor(fExecutor, parentRequestMonitor);
}
void startUpdate() {
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] startUpdate " + fLowIndex + '-' + fHighIndex); //$NON-NLS-1$
fContentProvider.update(new IChildrenUpdate[] {
new VMChildrenUpdate(fCurrentPath, fViewerInput, fPresentationContext, fLowIndex, fHighIndex - fLowIndex + 1, this)
new VMChildrenUpdate(fCurrentPath, fViewerInput, fPresentationContext, -1, -1, this)
});
}
void setRange(int low, int high) {
@ -153,6 +158,7 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
public void run() {
final List<Object> data= getData();
if (data != null && !data.isEmpty()) {
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] gotChildUpdate " + data.size()); //$NON-NLS-1$
fStack.push(new UpdateLevel(fCurrentPath, data));
}
processNext();
@ -196,6 +202,7 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
IElementLabelProvider labelProvider = (IElementLabelProvider) ((IAdaptable)data).getAdapter(IElementLabelProvider.class);
if (labelProvider != null) {
++fPendingUpdates;
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] labelUpdate " + data); //$NON-NLS-1$
labelProvider.update(new ILabelUpdate[] {
new DummyLabelUpdate(data, path, fRequestMonitor)
});
@ -207,13 +214,15 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
TreeViewer treeViewer = (TreeViewer) fViewer;
if (treeViewer.getExpandedState(data)) {
fCurrentPath = path;
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] childrenUpdate " + data); //$NON-NLS-1$
fContentProvider.update(new IChildrenUpdate[] {
new VMChildrenUpdate(path, fViewerInput, fPresentationContext, -1, -1, this)
});
return;
} else {
} else if (fIndex >= fLowIndex) {
// update also the hasChildren flag
++fPendingUpdates;
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] hasChildUpdate " + data); //$NON-NLS-1$
fContentProvider.update(new IHasChildrenUpdate[] {
new VMHasChildrenUpdate(path, fViewerInput, fPresentationContext, new DataRequestMonitor<Boolean>(fExecutor, fRequestMonitor))
});