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

View file

@ -185,7 +185,16 @@ public class ExpressionManagerVMNode extends AbstractVMNode
final CountingRequestMonitor multiRm = new ViewerCountingRequestMonitor(getVMProvider().getExecutor(), update); final CountingRequestMonitor multiRm = new ViewerCountingRequestMonitor(getVMProvider().getExecutor(), update);
int multiRmCount = 0; 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) { if (i < expressions.length) {
multiRmCount++; multiRmCount++;
final int childIndex = i; 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/delta = false
org.eclipse.dd.dsf.ui/debug/vm/cache = 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/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.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; 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.CountingRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfExecutor; import org.eclipse.dd.dsf.concurrent.DsfExecutor;
import org.eclipse.dd.dsf.concurrent.DsfRunnable; 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.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.datamodel.IDMData; 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 ); getModelDataFromService(node, update, service, dmc, rm, executor, entry );
} }
else { else {
dsfExecutor.execute(new DsfRunnable() { try {
public void run() { dsfExecutor.execute(new DsfRunnable() {
getModelDataFromService(node, update, service, dmc, rm, executor, entry ); 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.IAdaptable;
import org.eclipse.core.runtime.IStatus; 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.CountingRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.DsfRunnable; import org.eclipse.dd.dsf.concurrent.DsfRunnable;
@ -39,6 +40,9 @@ import org.eclipse.swt.graphics.RGB;
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> { 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 static final class UpdateLevel {
private final List<Object> fChildren; private final List<Object> fChildren;
private final TreePath fPath; private final TreePath fPath;
@ -135,8 +139,9 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
fRequestMonitor = new CountingRequestMonitor(fExecutor, parentRequestMonitor); fRequestMonitor = new CountingRequestMonitor(fExecutor, parentRequestMonitor);
} }
void startUpdate() { void startUpdate() {
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] startUpdate " + fLowIndex + '-' + fHighIndex); //$NON-NLS-1$
fContentProvider.update(new IChildrenUpdate[] { 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) { void setRange(int low, int high) {
@ -153,6 +158,7 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
public void run() { public void run() {
final List<Object> data= getData(); final List<Object> data= getData();
if (data != null && !data.isEmpty()) { if (data != null && !data.isEmpty()) {
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] gotChildUpdate " + data.size()); //$NON-NLS-1$
fStack.push(new UpdateLevel(fCurrentPath, data)); fStack.push(new UpdateLevel(fCurrentPath, data));
} }
processNext(); processNext();
@ -196,6 +202,7 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
IElementLabelProvider labelProvider = (IElementLabelProvider) ((IAdaptable)data).getAdapter(IElementLabelProvider.class); IElementLabelProvider labelProvider = (IElementLabelProvider) ((IAdaptable)data).getAdapter(IElementLabelProvider.class);
if (labelProvider != null) { if (labelProvider != null) {
++fPendingUpdates; ++fPendingUpdates;
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] labelUpdate " + data); //$NON-NLS-1$
labelProvider.update(new ILabelUpdate[] { labelProvider.update(new ILabelUpdate[] {
new DummyLabelUpdate(data, path, fRequestMonitor) new DummyLabelUpdate(data, path, fRequestMonitor)
}); });
@ -207,13 +214,15 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
TreeViewer treeViewer = (TreeViewer) fViewer; TreeViewer treeViewer = (TreeViewer) fViewer;
if (treeViewer.getExpandedState(data)) { if (treeViewer.getExpandedState(data)) {
fCurrentPath = path; fCurrentPath = path;
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] childrenUpdate " + data); //$NON-NLS-1$
fContentProvider.update(new IChildrenUpdate[] { fContentProvider.update(new IChildrenUpdate[] {
new VMChildrenUpdate(path, fViewerInput, fPresentationContext, -1, -1, this) new VMChildrenUpdate(path, fViewerInput, fPresentationContext, -1, -1, this)
}); });
return; return;
} else { } else if (fIndex >= fLowIndex) {
// update also the hasChildren flag // update also the hasChildren flag
++fPendingUpdates; ++fPendingUpdates;
if (DEBUG) System.out.println("[MultiLevelUpdateHandler] hasChildUpdate " + data); //$NON-NLS-1$
fContentProvider.update(new IHasChildrenUpdate[] { fContentProvider.update(new IHasChildrenUpdate[] {
new VMHasChildrenUpdate(path, fViewerInput, fPresentationContext, new DataRequestMonitor<Boolean>(fExecutor, fRequestMonitor)) new VMHasChildrenUpdate(path, fViewerInput, fPresentationContext, new DataRequestMonitor<Boolean>(fExecutor, fRequestMonitor))
}); });