1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 578400: Handle refresh event to show right source code

When the ICommandControlRefreshAllDMEvent is sent, open the coresponding
source file to the new stack frame. It could be the same or a completly
different file as before the event.

Contributed by STMicroelectronics

Also-By: Jonah Graham <jonah@kichwacoders.com>
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
Change-Id: Ib99f19f444a5bae1d99072ec9ed07e5666732bb6
This commit is contained in:
Torbjörn Svensson 2022-01-29 16:27:31 +01:00 committed by Jonah Graham
parent 72efb17cda
commit fcf416ab6d

View file

@ -43,6 +43,7 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.StateChangeReason;
import org.eclipse.cdt.dsf.debug.service.IStack;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMData;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.debug.sourcelookup.DsfSourceLookupParticipant;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController;
import org.eclipse.cdt.dsf.debug.ui.viewmodel.SteppingController.ISteppingControlParticipant;
@ -986,6 +987,28 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
startAnnotationClearingJob(e.getDMContext());
}
/**
* @noreference This method is not intended to be referenced by clients.
*/
@DsfServiceEventHandler
public void eventDispatched(final ICommandControlService.ICommandControlRefreshAllDMEvent e) {
if (DEBUG) {
System.out.println("[DsfSourceDisplayAdapter] eventDispatched e=" + e); //$NON-NLS-1$
}
// trigger source display immediately (should be optional?)
Display.getDefault().asyncExec(() -> {
Object context = DebugUITools.getDebugContext();
if (context instanceof IDMVMContext) {
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, true);
return;
}
}
});
}
@DsfServiceEventHandler
public void eventDispatched(final IRunControl.ISuspendedDMEvent e) {
updateStepTiming();