mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[247931] [disassembly] IP annotation does not keep up when stepping fast
This commit is contained in:
parent
460e9feb79
commit
3e3b711def
4 changed files with 62 additions and 29 deletions
|
@ -1 +1,3 @@
|
|||
org.eclipse.dd.dsf.debug.ui/debug = false
|
||||
org.eclipse.dd.dsf.debug.ui/stepping = false
|
||||
org.eclipse.dd.dsf.debug.ui/disassembly = false
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.DsfExecutor;
|
||||
import org.eclipse.dd.dsf.concurrent.DsfRunnable;
|
||||
|
@ -74,6 +75,8 @@ public final class SteppingController implements IStepQueueManager
|
|||
*/
|
||||
public final static int MAX_STEP_DELAY= 1000;
|
||||
|
||||
private final static boolean DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.dd.dsf.debug.ui/stepping")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
/**
|
||||
* Indicates that the given context has been stepping for some time,
|
||||
* and the UI (views and actions) may need to be updated accordingly.
|
||||
|
@ -349,6 +352,7 @@ public final class SteppingController implements IStepQueueManager
|
|||
}
|
||||
|
||||
private void doStep(final IExecutionDMContext execCtx, final StepType stepType) {
|
||||
if (DEBUG) System.out.println("[SteppingController] doStep ctx="+execCtx); //$NON-NLS-1$
|
||||
disableStepping(execCtx);
|
||||
updateLastStepTime(execCtx);
|
||||
|
||||
|
@ -465,6 +469,7 @@ public final class SteppingController implements IStepQueueManager
|
|||
* @param execCtx
|
||||
*/
|
||||
private void doneStepping(final IExecutionDMContext execCtx) {
|
||||
if (DEBUG) System.out.println("[SteppingController] doneStepping ctx=" + execCtx); //$NON-NLS-1$
|
||||
enableStepping(execCtx);
|
||||
processStepQueue(execCtx);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.core.runtime.IAdaptable;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
|
||||
import org.eclipse.dd.dsf.concurrent.DsfExecutor;
|
||||
|
@ -193,7 +194,7 @@ import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
|
|||
@SuppressWarnings("restriction")
|
||||
public abstract class DisassemblyPart extends WorkbenchPart implements IDisassemblyPart, IViewportListener, ITextPresentationListener, SessionEndedListener {
|
||||
|
||||
private final static boolean DEBUG = DsfDebugUIPlugin.getDefault().isDebugging();
|
||||
private final static boolean DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.dd.dsf.debug.ui/disassembly")); //$NON-NLS-1$//$NON-NLS-2$
|
||||
|
||||
/**
|
||||
* Annotation model attachment key for breakpoint annotations.
|
||||
|
@ -2409,26 +2410,40 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
|
||||
@DsfServiceEventHandler
|
||||
public void handleEvent(IExitedDMEvent event) {
|
||||
if (event.getDMContext().equals(fTargetContext)
|
||||
|| DMContexts.isAncestorOf(event.getDMContext(), fTargetContext)) {
|
||||
setDebugContext(null);
|
||||
final IExecutionDMContext context= event.getDMContext();
|
||||
if (context.equals(fTargetContext)
|
||||
|| DMContexts.isAncestorOf(fTargetContext, context)) {
|
||||
asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
setDebugContext(null);
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void handleEvent(ISuspendedDMEvent event) {
|
||||
if (event.getDMContext().equals(fTargetContext)
|
||||
|| DMContexts.isAncestorOf(event.getDMContext(), fTargetContext)) {
|
||||
updatePC(PC_UNKNOWN);
|
||||
final IExecutionDMContext context= event.getDMContext();
|
||||
if (context.equals(fTargetContext)
|
||||
|| DMContexts.isAncestorOf(fTargetContext, context)) {
|
||||
asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
updatePC(PC_UNKNOWN);
|
||||
}
|
||||
});
|
||||
firePropertyChange(PROP_SUSPENDED);
|
||||
}
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void handleEvent(IResumedDMEvent event) {
|
||||
if (event.getDMContext().equals(fTargetContext)
|
||||
|| DMContexts.isAncestorOf(event.getDMContext(), fTargetContext)) {
|
||||
updatePC(PC_RUNNING);
|
||||
final IExecutionDMContext context= event.getDMContext();
|
||||
if (context.equals(fTargetContext)
|
||||
|| DMContexts.isAncestorOf(fTargetContext, context)) {
|
||||
asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
updatePC(PC_RUNNING);
|
||||
}
|
||||
});
|
||||
firePropertyChange(PROP_SUSPENDED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,16 +147,18 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
|
||||
private final IWorkbenchPage fPage;
|
||||
private final FrameData fFrameData;
|
||||
private final boolean fEventTriggered;
|
||||
|
||||
/**
|
||||
* Constructs a new source lookup job.
|
||||
*/
|
||||
public LookupJob(FrameData frameData, IWorkbenchPage page) {
|
||||
public LookupJob(FrameData frameData, IWorkbenchPage page, boolean eventTriggered) {
|
||||
super("DSF Source Lookup"); //$NON-NLS-1$
|
||||
setPriority(Job.INTERACTIVE);
|
||||
setSystem(true);
|
||||
fFrameData = frameData;
|
||||
fPage = page;
|
||||
fEventTriggered = eventTriggered;
|
||||
}
|
||||
|
||||
IDMContext getDmc() { return fFrameData.fDmc; }
|
||||
|
@ -173,7 +175,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
fPrevResult = result;
|
||||
fPrevFrameData = fFrameData;
|
||||
fRunningLookupJob = null;
|
||||
startDisplayJob(fPrevResult, fFrameData, fPage);
|
||||
startDisplayJob(fPrevResult, fFrameData, fPage, fEventTriggered);
|
||||
}
|
||||
}});
|
||||
return Status.OK_STATUS;
|
||||
|
@ -230,17 +232,17 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
* Job that positions the editor and paints the IP Annotation for given DMC.
|
||||
*/
|
||||
class DisplayJob extends UIJob {
|
||||
private SourceLookupResult fResult;
|
||||
private IWorkbenchPage fPage;
|
||||
private FrameData fFrameData;
|
||||
private final SourceLookupResult fResult;
|
||||
private final IWorkbenchPage fPage;
|
||||
private final FrameData fFrameData;
|
||||
|
||||
private DsfRunnable fDisplayJobFinishedRunnable = new DsfRunnable() {
|
||||
private final DsfRunnable fDisplayJobFinishedRunnable = new DsfRunnable() {
|
||||
public void run() {
|
||||
// If the current display job does not match up with "this", it means that this job got canceled
|
||||
// after it already completed and after this runnable was queued into the dispatch thread.
|
||||
if (fRunningDisplayJob == DisplayJob.this) {
|
||||
fRunningDisplayJob = null;
|
||||
if (!fDoneStepping.getAndSet(true)) {
|
||||
if (fEventTriggered && !fDoneStepping.getAndSet(true)) {
|
||||
doneStepping(fResult.getDmc());
|
||||
}
|
||||
serviceDisplayAndClearingJobs();
|
||||
|
@ -248,22 +250,24 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
}
|
||||
};
|
||||
|
||||
private AtomicBoolean fDoneStepping = new AtomicBoolean(false);
|
||||
private final AtomicBoolean fDoneStepping = new AtomicBoolean(false);
|
||||
private IRegion fRegion;
|
||||
private ITextViewer fTextViewer;
|
||||
private final boolean fEventTriggered;
|
||||
|
||||
IDMContext getDmc() { return fResult.getDmc(); }
|
||||
|
||||
/**
|
||||
* Constructs a new source display job
|
||||
*/
|
||||
public DisplayJob(SourceLookupResult result, FrameData frameData, IWorkbenchPage page) {
|
||||
public DisplayJob(SourceLookupResult result, FrameData frameData, IWorkbenchPage page, boolean eventTriggered) {
|
||||
super("Debug Source Display"); //$NON-NLS-1$
|
||||
setSystem(true);
|
||||
setPriority(Job.INTERACTIVE);
|
||||
fResult = result;
|
||||
fFrameData = frameData;
|
||||
fPage = page;
|
||||
fEventTriggered = eventTriggered;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -614,16 +618,18 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
* @see org.eclipse.debug.ui.contexts.ISourceDisplayAdapter#displaySource(java.lang.Object, org.eclipse.ui.IWorkbenchPage, boolean)
|
||||
*/
|
||||
public void displaySource(Object context, final IWorkbenchPage page, final boolean force) {
|
||||
fStepCount = 0;
|
||||
|
||||
if (!(context instanceof IDMVMContext)) return;
|
||||
final IDMContext dmc = ((IDMVMContext)context).getDMContext();
|
||||
|
||||
// Quick test. DMC is checked again in source lookup participant, but
|
||||
// it's much quicker to test here.
|
||||
if (!(dmc instanceof IFrameDMContext)) return;
|
||||
doDisplaySource((IFrameDMContext) dmc, page, force);
|
||||
doDisplaySource((IFrameDMContext) dmc, page, force, false);
|
||||
}
|
||||
|
||||
private void doDisplaySource(final IFrameDMContext context, final IWorkbenchPage page, final boolean force) {
|
||||
private void doDisplaySource(final IFrameDMContext context, final IWorkbenchPage page, final boolean force, final boolean eventTriggered) {
|
||||
if (context.getLevel() < 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -648,9 +654,9 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
frameData.fFile = data.getFile();
|
||||
if (!force && frameData.equals(fPrevFrameData)) {
|
||||
fPrevResult.updateArtifact(context);
|
||||
startDisplayJob(fPrevResult, frameData, page);
|
||||
startDisplayJob(fPrevResult, frameData, page, eventTriggered);
|
||||
} else {
|
||||
startLookupJob(frameData, page);
|
||||
startLookupJob(frameData, page, eventTriggered);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -665,25 +671,30 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
}
|
||||
}
|
||||
|
||||
private void startLookupJob(final FrameData frameData, final IWorkbenchPage page) {
|
||||
private void startLookupJob(final FrameData frameData, final IWorkbenchPage page, boolean eventTriggered) {
|
||||
// If there is a previous lookup job running, cancel it.
|
||||
if (fRunningLookupJob != null) {
|
||||
fRunningLookupJob.cancel();
|
||||
}
|
||||
|
||||
fRunningLookupJob = new LookupJob(frameData, page);
|
||||
fRunningLookupJob = new LookupJob(frameData, page, eventTriggered);
|
||||
fRunningLookupJob.schedule();
|
||||
}
|
||||
|
||||
// To be called only on dispatch thread.
|
||||
private void startDisplayJob(SourceLookupResult lookupResult, FrameData frameData, IWorkbenchPage page) {
|
||||
DisplayJob nextDisplayJob = new DisplayJob(lookupResult, frameData, page);
|
||||
private void startDisplayJob(SourceLookupResult lookupResult, FrameData frameData, IWorkbenchPage page) {
|
||||
startDisplayJob(lookupResult, frameData, page, false);
|
||||
}
|
||||
|
||||
// To be called only on dispatch thread.
|
||||
private void startDisplayJob(SourceLookupResult lookupResult, FrameData frameData, IWorkbenchPage page, boolean eventTriggered) {
|
||||
DisplayJob nextDisplayJob = new DisplayJob(lookupResult, frameData, page, eventTriggered);
|
||||
if (fRunningDisplayJob != null) {
|
||||
fPendingDisplayJob = null;
|
||||
IExecutionDMContext[] execCtxs = DMContexts.getAllAncestorsOfType(frameData.fDmc, IExecutionDMContext.class);
|
||||
fPendingExecDmcsToClear.removeAll(Arrays.asList(execCtxs));
|
||||
|
||||
if (frameData.isIdentical(fRunningDisplayJob.fFrameData)) {
|
||||
if (!eventTriggered && frameData.isIdentical(fRunningDisplayJob.fFrameData)) {
|
||||
// identical location - we are done
|
||||
return;
|
||||
}
|
||||
|
@ -793,7 +804,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
|||
final IDMContext dmc = ((IDMVMContext)context).getDMContext();
|
||||
if (dmc instanceof IFrameDMContext && DMContexts.isAncestorOf(dmc, e.getDMContext())) {
|
||||
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
|
||||
doDisplaySource((IFrameDMContext) dmc, page, false);
|
||||
doDisplaySource((IFrameDMContext) dmc, page, false, true);
|
||||
}
|
||||
}
|
||||
}});
|
||||
|
|
Loading…
Add table
Reference in a new issue