mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 12:11:55 +00:00
Merge remote-tracking branch 'origin/GP-4905_Dan_fixCloseAll' into Ghidra_11.2
This commit is contained in:
commit
1a1ea00a48
@ -197,6 +197,9 @@ public class TraceRmiHandler implements TraceRmiConnection {
|
|||||||
List<OpenTrace> all = List.copyOf(byId.values());
|
List<OpenTrace> all = List.copyOf(byId.values());
|
||||||
byId.clear();
|
byId.clear();
|
||||||
byTrace.clear();
|
byTrace.clear();
|
||||||
|
for (OpenTrace open : all) {
|
||||||
|
plugin.withdrawTarget(open.target);
|
||||||
|
}
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,11 @@ import ghidra.debug.api.tracermi.TraceRmiConnection;
|
|||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
|
|
||||||
public class TraceRmiConnectionManagerProviderTest extends AbstractGhidraHeadedDebuggerTest {
|
public class TraceRmiConnectionManagerProviderTest extends AbstractGhidraHeadedDebuggerTest {
|
||||||
|
private static final String SCHEMA_XML = """
|
||||||
|
<context>
|
||||||
|
<schema name="Root" elementResync="NEVER" attributeResync="NEVER" />
|
||||||
|
</context>
|
||||||
|
""";
|
||||||
TraceRmiConnectionManagerProvider provider;
|
TraceRmiConnectionManagerProvider provider;
|
||||||
TraceRmiService traceRmiService;
|
TraceRmiService traceRmiService;
|
||||||
DebuggerControlService controlService;
|
DebuggerControlService controlService;
|
||||||
@ -178,6 +183,17 @@ public class TraceRmiConnectionManagerProviderTest extends AbstractGhidraHeadedD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCloseWithdrawsTargets() throws Exception {
|
||||||
|
Target target;
|
||||||
|
try (Cx cx = Cx.connect(traceRmiService, "Test client")) {
|
||||||
|
cx.client.createTrace(0, "bash");
|
||||||
|
target = waitForPass(() -> Unique.assertOne(targetService.getPublishedTargets()));
|
||||||
|
}
|
||||||
|
// Outside the try, the connection has been closed
|
||||||
|
waitForPass(() -> assertFalse(targetService.getPublishedTargets().contains(target)));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testServerNode() throws Exception {
|
public void testServerNode() throws Exception {
|
||||||
TraceRmiServerNode node = TraceRmiConnectionTreeHelper.getServerNode(provider.rootNode);
|
TraceRmiServerNode node = TraceRmiConnectionTreeHelper.getServerNode(provider.rootNode);
|
||||||
@ -213,8 +229,7 @@ public class TraceRmiConnectionManagerProviderTest extends AbstractGhidraHeadedD
|
|||||||
}
|
}
|
||||||
|
|
||||||
public record Cx(SocketChannel channel, TestTraceRmiClient client,
|
public record Cx(SocketChannel channel, TestTraceRmiClient client,
|
||||||
TraceRmiConnection connection)
|
TraceRmiConnection connection) implements AutoCloseable {
|
||||||
implements AutoCloseable {
|
|
||||||
public static Cx complete(TraceRmiAcceptor acceptor, String description)
|
public static Cx complete(TraceRmiAcceptor acceptor, String description)
|
||||||
throws IOException, CancelledException {
|
throws IOException, CancelledException {
|
||||||
SocketChannel channel = null;
|
SocketChannel channel = null;
|
||||||
@ -378,11 +393,7 @@ public class TraceRmiConnectionManagerProviderTest extends AbstractGhidraHeadedD
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testActivateTargetNode() throws Exception {
|
public void testActivateTargetNode() throws Exception {
|
||||||
SchemaContext ctx = XmlSchemaContext.deserialize("""
|
SchemaContext ctx = XmlSchemaContext.deserialize(SCHEMA_XML);
|
||||||
<context>
|
|
||||||
<schema name="Root" elementResync="NEVER" attributeResync="NEVER" />
|
|
||||||
</context>
|
|
||||||
""");
|
|
||||||
try (Cx cx = Cx.connect(traceRmiService, "Test client")) {
|
try (Cx cx = Cx.connect(traceRmiService, "Test client")) {
|
||||||
cx.client.createTrace(1, "bash");
|
cx.client.createTrace(1, "bash");
|
||||||
try (Tx tx = cx.client.new Tx(1, 1, "Create snapshots")) {
|
try (Tx tx = cx.client.new Tx(1, 1, "Create snapshots")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user