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

Bug 578400: Don't assume PC has not changed on refresh

Contributed by STMicroelectronics

Also-By: Jonah Graham <jonah@kichwacoders.com>
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
Change-Id: Ic03df0d032890aac9196b3c437148c8d82499d32
This commit is contained in:
Torbjörn Svensson 2022-01-29 16:37:32 +01:00 committed by Jonah Graham
parent fcf416ab6d
commit 21b442bd7f
3 changed files with 29 additions and 2 deletions

View file

@ -218,4 +218,10 @@ public interface IDisassemblyBackend {
* @return the last know address, -1 if unknown
*/
BigInteger getLastKnownAddress();
/**
* Requests that the backend clear any caches that it has so that refresh operations obtain fresh data.
*/
default void clearCaches() {
}
}

View file

@ -25,6 +25,7 @@ import static org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils
import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
@ -45,6 +46,7 @@ import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Query;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.datamodel.IDMContext;
import org.eclipse.cdt.dsf.debug.service.ICachingService;
import org.eclipse.cdt.dsf.debug.service.IDisassembly;
import org.eclipse.cdt.dsf.debug.service.IDisassembly.IDisassemblyDMContext;
import org.eclipse.cdt.dsf.debug.service.IDisassembly2;
@ -1307,4 +1309,23 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
protected void handleError(IStatus status) {
DsfUIPlugin.log(status);
}
@Override
public void clearCaches() {
final DsfExecutor executor = getSession().getExecutor();
executor.execute(new DsfRunnable() {
@Override
public void run() {
List.of(IStack.class, IDisassembly.class, IExpressions.class, IRunControl.class, IRegisters.class,
ISourceLookup.class).forEach((clazz) -> {
Object o = getService(clazz);
if (o instanceof ICachingService) {
ICachingService cs = (ICachingService) o;
cs.flushCache(getExecutionDMContext());
}
});
}
});
}
}

View file

@ -3277,9 +3277,9 @@ public abstract class DisassemblyPart extends WorkbenchPart
@Override
public void refresh() {
fBackend.clearCaches();
asyncExec(() -> {
fPCLastAddress = getTopAddress();
refreshView(10);
updatePC(PC_UNKNOWN);
});
}
}