mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 11:31:43 +00:00
Merge remote-tracking branch 'origin/GP-0_Dan_testFixes-2024-09-06-1'
This commit is contained in:
commit
d7c1f65f43
@ -188,6 +188,18 @@ public class TraceRmiHandler implements TraceRmiConnection {
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Call only for cleanup. Cannot be re-used after this
|
||||
*
|
||||
* @return the open traces that were removed
|
||||
*/
|
||||
public synchronized List<OpenTrace> clearAll() {
|
||||
List<OpenTrace> all = List.copyOf(byId.values());
|
||||
byId.clear();
|
||||
byTrace.clear();
|
||||
return all;
|
||||
}
|
||||
|
||||
public CompletableFuture<OpenTrace> getFirstAsync() {
|
||||
return first;
|
||||
}
|
||||
@ -273,14 +285,15 @@ public class TraceRmiHandler implements TraceRmiConnection {
|
||||
terminateTerminals();
|
||||
|
||||
socket.close();
|
||||
synchronized (openTxes) {
|
||||
while (!openTxes.isEmpty()) {
|
||||
Tid nextKey = openTxes.keySet().iterator().next();
|
||||
OpenTx open = openTxes.remove(nextKey);
|
||||
open.tx.close();
|
||||
}
|
||||
while (!openTraces.isEmpty()) {
|
||||
DoId nextKey = openTraces.idSet().iterator().next();
|
||||
OpenTrace open = openTraces.removeById(nextKey);
|
||||
}
|
||||
|
||||
for (OpenTrace open : openTraces.clearAll()) {
|
||||
if (traceManager == null || traceManager.isSaveTracesByDefault()) {
|
||||
try (CloseableTaskMonitor monitor = plugin.createMonitor()) {
|
||||
open.trace.save("Save on Disconnect", monitor);
|
||||
@ -610,7 +623,10 @@ public class TraceRmiHandler implements TraceRmiConnection {
|
||||
}
|
||||
|
||||
protected Tid requireAvailableTid(Tid tid) {
|
||||
OpenTx tx = openTxes.get(tid);
|
||||
OpenTx tx;
|
||||
synchronized (openTxes) {
|
||||
tx = openTxes.get(tid);
|
||||
}
|
||||
if (tx != null) {
|
||||
throw new TxIdInUseError();
|
||||
}
|
||||
@ -946,7 +962,10 @@ public class TraceRmiHandler implements TraceRmiConnection {
|
||||
}
|
||||
|
||||
protected ReplyEndTx handleEndTx(RequestEndTx req) {
|
||||
OpenTx tx = openTxes.remove(new Tid(new DoId(req.getOid()), req.getTxid().getId()));
|
||||
OpenTx tx;
|
||||
synchronized (openTxes) {
|
||||
tx = openTxes.remove(new Tid(new DoId(req.getOid()), req.getTxid().getId()));
|
||||
}
|
||||
if (tx == null) {
|
||||
throw new InvalidTxIdError(req.getTxid().getId());
|
||||
}
|
||||
@ -1159,7 +1178,9 @@ public class TraceRmiHandler implements TraceRmiConnection {
|
||||
@SuppressWarnings("resource")
|
||||
OpenTx tx =
|
||||
new OpenTx(tid, open.trace.openTransaction(req.getDescription()), req.getUndoable());
|
||||
synchronized (openTxes) {
|
||||
openTxes.put(tx.txId, tx);
|
||||
}
|
||||
return ReplyStartTx.getDefaultInstance();
|
||||
}
|
||||
|
||||
|
@ -700,6 +700,11 @@ public abstract class AbstractDebuggerParameterDialog<P> extends DialogComponent
|
||||
return;
|
||||
}
|
||||
memorized.put(parameterNameAndType(parameter), value);
|
||||
PropertyEditor editor = paramEditors.get(parameter);
|
||||
// Editors may not be populated yet
|
||||
if (editor != null) {
|
||||
setEditorValue(editor, parameter, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void forgetMemorizedArguments() {
|
||||
|
@ -37,7 +37,8 @@ import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.core.debug.DebuggerPluginPackage;
|
||||
import ghidra.app.plugin.core.debug.gui.DebuggerResources.DisconnectAllAction;
|
||||
import ghidra.app.plugin.core.debug.service.model.launch.DebuggerProgramLaunchOpinion;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.services.DebuggerModelService;
|
||||
import ghidra.app.services.DebuggerTraceManagerService;
|
||||
import ghidra.app.services.DebuggerTraceManagerService.ActivationCause;
|
||||
import ghidra.async.AsyncFence;
|
||||
import ghidra.dbg.*;
|
||||
@ -380,11 +381,18 @@ public class DebuggerModelServicePlugin extends Plugin
|
||||
protected void removeRecorder(TraceRecorder recorder) {
|
||||
synchronized (recordersByTarget) {
|
||||
TraceRecorder old = recordersByTarget.remove(recorder.getTarget());
|
||||
/**
|
||||
* Possible race condition when quickly launching and stopping a recording. If it's
|
||||
* already removed, that's actually fine. If we get something non-null that doesn't
|
||||
* match, then yeah, something's truly gone wrong.
|
||||
*/
|
||||
if (old != null) {
|
||||
if (old != recorder) {
|
||||
throw new AssertionError("Container-recorder mix up");
|
||||
}
|
||||
old.removeListener(listenerOnRecorders);
|
||||
}
|
||||
}
|
||||
recorderListeners.invoke().elementRemoved(recorder);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user