mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-25 05:32:14 +00:00
GP-3028: Fix follow present and control mode timing issues.
This commit is contained in:
parent
5195aaebc1
commit
7a60300b65
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.debug.service.model.launch;
|
||||
|
||||
import static ghidra.async.AsyncUtils.*;
|
||||
import static ghidra.async.AsyncUtils.loop;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@ -31,6 +31,7 @@ import org.jdom.JDOMException;
|
||||
|
||||
import ghidra.app.plugin.core.debug.gui.objects.components.DebuggerMethodInvocationDialog;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
|
||||
import ghidra.app.services.ModuleMapProposal.ModuleMapEntry;
|
||||
import ghidra.async.*;
|
||||
import ghidra.dbg.*;
|
||||
@ -553,7 +554,8 @@ public abstract class AbstractDebuggerProgramLaunchOffer implements DebuggerProg
|
||||
Trace trace = recorder.getTrace();
|
||||
Swing.runLater(() -> {
|
||||
traceManager.openTrace(trace);
|
||||
traceManager.activateTrace(trace);
|
||||
traceManager.activate(traceManager.resolveTrace(trace),
|
||||
ActivationCause.START_RECORDING);
|
||||
});
|
||||
}
|
||||
return recorder;
|
||||
|
@ -551,10 +551,17 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||
return coordinates.platform(platform);
|
||||
}
|
||||
|
||||
protected DebuggerCoordinates doSetCurrent(DebuggerCoordinates newCurrent) {
|
||||
protected DebuggerCoordinates doSetCurrent(DebuggerCoordinates newCurrent,
|
||||
ActivationCause cause) {
|
||||
newCurrent = newCurrent == null ? DebuggerCoordinates.NOWHERE : newCurrent;
|
||||
newCurrent = fillInRecorder(newCurrent.getTrace(), newCurrent);
|
||||
newCurrent = fillInPlatform(newCurrent);
|
||||
if (cause == ActivationCause.START_RECORDING || cause == ActivationCause.FOLLOW_PRESENT) {
|
||||
TraceRecorder recorder = newCurrent.getRecorder();
|
||||
if (recorder != null) {
|
||||
newCurrent = newCurrent.snap(recorder.getSnap());
|
||||
}
|
||||
}
|
||||
synchronized (listenersByTrace) {
|
||||
if (current.equals(newCurrent)) {
|
||||
return null;
|
||||
@ -687,7 +694,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||
public void processEvent(PluginEvent event) {
|
||||
super.processEvent(event);
|
||||
if (event instanceof TraceActivatedPluginEvent ev) {
|
||||
doSetCurrent(ev.getActiveCoordinates());
|
||||
doSetCurrent(ev.getActiveCoordinates(), ev.getCause());
|
||||
}
|
||||
else if (event instanceof TraceClosedPluginEvent ev) {
|
||||
doTraceClosed(ev.getTrace());
|
||||
@ -800,7 +807,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||
}
|
||||
varView.setSnap(snap);
|
||||
fireLocationEvent(coordinates, cause);
|
||||
}, SwingExecutorService.MAYBE_NOW);
|
||||
}, SwingExecutorService.LATER); // Not MAYBE_NOW lest snap events get out of order
|
||||
}
|
||||
|
||||
protected void fireLocationEvent(DebuggerCoordinates coordinates, ActivationCause cause) {
|
||||
@ -1076,7 +1083,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||
}
|
||||
|
||||
protected void activateNoFocus(DebuggerCoordinates coordinates, ActivationCause cause) {
|
||||
DebuggerCoordinates resolved = doSetCurrent(coordinates);
|
||||
DebuggerCoordinates resolved = doSetCurrent(coordinates, cause);
|
||||
if (resolved == null) {
|
||||
return;
|
||||
}
|
||||
@ -1142,7 +1149,7 @@ public class DebuggerTraceManagerServicePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
prev = current;
|
||||
resolved = doSetCurrent(coordinates);
|
||||
resolved = doSetCurrent(coordinates, cause);
|
||||
if (resolved == null) {
|
||||
return AsyncUtils.NIL;
|
||||
}
|
||||
|
@ -66,7 +66,9 @@ public class MultiToolTraceListenerManager<L extends AbstractMultiToolTraceListe
|
||||
}
|
||||
|
||||
public synchronized void traceClosed(PluginTool tool, Trace trace) {
|
||||
if (listenersByTrace.get(trace).closedBy(tool)) {
|
||||
L listener = listenersByTrace.get(trace);
|
||||
// It should never be null, but somehow it happened, so....
|
||||
if (listener != null && listener.closedBy(tool)) {
|
||||
listenersByTrace.remove(trace).dispose();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user