mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 386175 - all threads that have ever been displayed get refreshed on
suspend Change-Id: I3b1e842e8dd82463fe2cc35bcbdb0e52ae16baef Signed-off-by: Pawel Piech <pawel.1.piech@gmail.com> Reviewed-on: https://git.eclipse.org/r/9088 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
70f50274b4
commit
4f8e498fa7
4 changed files with 98 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2013 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -302,7 +302,10 @@ public abstract class AbstractContainerVMNode extends AbstractExecutionContextVM
|
|||
return IModelDelta.SELECT | IModelDelta.EXPAND;
|
||||
} else if (e instanceof StateChangedEvent) {
|
||||
return IModelDelta.STATE;
|
||||
}
|
||||
} else if (e instanceof FullStackRefreshEvent &&
|
||||
(((FullStackRefreshEvent)e).getTriggeringEvent() instanceof IContainerSuspendedDMEvent)) {
|
||||
return IModelDelta.CONTENT;
|
||||
}
|
||||
return IModelDelta.NO_CHANGE;
|
||||
}
|
||||
|
||||
|
@ -389,9 +392,72 @@ public abstract class AbstractContainerVMNode extends AbstractExecutionContextVM
|
|||
// If there is a state change needed on the container, update the container
|
||||
if (dmc instanceof IContainerDMContext)
|
||||
parentDelta.addNode(createVMContext(dmc), IModelDelta.STATE);
|
||||
} else if (e instanceof FullStackRefreshEvent) {
|
||||
FullStackRefreshEvent refreshEvent = (FullStackRefreshEvent)e;
|
||||
if (refreshEvent.getTriggeringEvent() instanceof IContainerSuspendedDMEvent) {
|
||||
// For a full container suspended event, issue a single change when we get
|
||||
// a FullStackRefreshEvent. This avoids refreshing all threads, even those
|
||||
// there are not visible
|
||||
// bug 386175
|
||||
IContainerSuspendedDMEvent containerTriggerEvent =
|
||||
(IContainerSuspendedDMEvent)refreshEvent.getTriggeringEvent();
|
||||
buildDeltaForFullStackRefreshEvent((IContainerDMContext)refreshEvent.getDMContext(),
|
||||
containerTriggerEvent.getTriggeringContexts(), parentDelta, nodeOffset, requestMonitor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
requestMonitor.done();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a delta in response to automatic refresh event generated after
|
||||
* every suspend event.
|
||||
* <p>
|
||||
* As opposed to the StackFrameVMNode handling of the refresh event, the
|
||||
* container handles only the refresh events for container suspended events,
|
||||
* and it refreshes the entire container.
|
||||
* <p>
|
||||
* The default behavior is to check if the thread is still stepping or
|
||||
* suspended and refresh the stack trace.
|
||||
*/
|
||||
protected void buildDeltaForFullStackRefreshEvent(final IContainerDMContext containerCtx,
|
||||
final IExecutionDMContext[] triggeringCtxs, final VMDelta parentDelta, final int nodeOffset,
|
||||
final RequestMonitor rm)
|
||||
{
|
||||
try {
|
||||
getSession().getExecutor().execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IRunControl runControlService = getServicesTracker().getService(IRunControl.class);
|
||||
if (runControlService == null) {
|
||||
// Required services have not initialized yet. Ignore the event.
|
||||
rm.done();
|
||||
return;
|
||||
}
|
||||
|
||||
// Refresh the whole list of stack frames unless the target is already stepping the next command. In
|
||||
// which case, the refresh will occur when the stepping sequence slows down or stops. Trying to
|
||||
// refresh the whole stack trace with every step would slow down stepping too much.
|
||||
boolean isStepping = false;
|
||||
for (IExecutionDMContext triggeringCtx : triggeringCtxs) {
|
||||
if (runControlService.isStepping(triggeringCtx)) {
|
||||
isStepping = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isStepping) {
|
||||
parentDelta.addNode(createVMContext(containerCtx), IModelDelta.CONTENT);
|
||||
}
|
||||
|
||||
rm.done();
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
// Session shut down, no delta to build.
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2010 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2013 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -156,7 +156,8 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
|
|||
}
|
||||
}
|
||||
} else if (event instanceof IRunControl.ISuspendedDMEvent) {
|
||||
final IExecutionDMContext exeContext= ((IRunControl.ISuspendedDMEvent) event).getDMContext();
|
||||
final IRunControl.ISuspendedDMEvent suspendEvent = (IRunControl.ISuspendedDMEvent)event;
|
||||
final IExecutionDMContext exeContext= suspendEvent.getDMContext();
|
||||
ScheduledFuture<?> refreshStackFramesFuture = getRefreshFuture(exeContext);
|
||||
// trigger delayed full stack frame update
|
||||
if (refreshStackFramesFuture != null) {
|
||||
|
@ -177,7 +178,7 @@ public class AbstractLaunchVMProvider extends AbstractDMVMProvider
|
|||
ScheduledFuture<?> future= fRefreshStackFramesFutures.get(exeContext);
|
||||
if (future != null && !isDisposed()) {
|
||||
fRefreshStackFramesFutures.remove(exeContext);
|
||||
handleEvent(new FullStackRefreshEvent(exeContext), null);
|
||||
handleEvent(new FullStackRefreshEvent(exeContext, suspendEvent), null);
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2008, 2014 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -11,6 +11,8 @@
|
|||
package org.eclipse.cdt.dsf.debug.ui.viewmodel.launch;
|
||||
|
||||
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
||||
|
||||
/**
|
||||
|
@ -21,8 +23,18 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
|
|||
*/
|
||||
public class FullStackRefreshEvent extends AbstractDMEvent<IExecutionDMContext> {
|
||||
|
||||
private final IDMEvent<? extends IDMContext> fTriggeringEvent;
|
||||
|
||||
public FullStackRefreshEvent(IExecutionDMContext execCtx) {
|
||||
this(execCtx, null);
|
||||
}
|
||||
|
||||
public FullStackRefreshEvent(IExecutionDMContext execCtx, IDMEvent<? extends IDMContext> triggeringEvent) {
|
||||
super(execCtx);
|
||||
fTriggeringEvent = triggeringEvent;
|
||||
}
|
||||
|
||||
public IDMEvent<? extends IDMContext> getTriggeringEvent() {
|
||||
return fTriggeringEvent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2010 Wind River Systems and others.
|
||||
* Copyright (c) 2006, 2014 Wind River Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -606,7 +606,9 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
|||
// label has changed.
|
||||
if (e instanceof ISuspendedDMEvent) {
|
||||
return IModelDelta.CONTENT | IModelDelta.EXPAND | IModelDelta.SELECT;
|
||||
} else if (e instanceof FullStackRefreshEvent) {
|
||||
} else if (e instanceof FullStackRefreshEvent &&
|
||||
!(((FullStackRefreshEvent)e).getTriggeringEvent() instanceof IContainerSuspendedDMEvent) )
|
||||
{
|
||||
return IModelDelta.CONTENT;
|
||||
} else if (e instanceof SteppingTimedOutEvent) {
|
||||
return IModelDelta.CONTENT;
|
||||
|
@ -657,8 +659,15 @@ public class StackFramesVMNode extends AbstractDMVMNode
|
|||
rm.done();
|
||||
}
|
||||
} else if (e instanceof FullStackRefreshEvent) {
|
||||
IExecutionDMContext execDmc = ((FullStackRefreshEvent)e).getDMContext();
|
||||
buildDeltaForFullStackRefreshEvent(execDmc, execDmc, parent, nodeOffset, rm);
|
||||
FullStackRefreshEvent refreshEvent = (FullStackRefreshEvent)e;
|
||||
if ( !(refreshEvent.getTriggeringEvent() instanceof IContainerSuspendedDMEvent)) {
|
||||
// Don't refresh each stack frame when we get an event for the entire container
|
||||
// Bug 386175
|
||||
IExecutionDMContext execDmc = ((FullStackRefreshEvent)e).getDMContext();
|
||||
buildDeltaForFullStackRefreshEvent(execDmc, execDmc, parent, nodeOffset, rm);
|
||||
} else {
|
||||
rm.done();
|
||||
}
|
||||
} else if (e instanceof ISuspendedDMEvent) {
|
||||
resetStackFrameLimit( ((ISuspendedDMEvent)e).getDMContext() );
|
||||
IExecutionDMContext execDmc = ((ISuspendedDMEvent)e).getDMContext();
|
||||
|
|
Loading…
Add table
Reference in a new issue