mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Merge remote-tracking branch 'origin/GP-5436_Dan_torchAsyncComm--SQUASHED'
This commit is contained in:
commit
7ca36e01d9
31 changed files with 42 additions and 130 deletions
|
@ -24,8 +24,5 @@ apply plugin: 'eclipse'
|
|||
eclipse.project.name = 'Debug Debugger-isf'
|
||||
|
||||
dependencies {
|
||||
api project(':Framework-AsyncComm')
|
||||
api project(':ProposedUtils')
|
||||
|
||||
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ apply plugin: 'eclipse'
|
|||
eclipse.project.name = 'Debug Debugger-rmi-trace'
|
||||
|
||||
dependencies {
|
||||
api project(':ProposedUtils')
|
||||
api project(':Pty')
|
||||
api project(':Debugger')
|
||||
api project(':Debugger-api')
|
||||
|
||||
testImplementation project(path: ':Generic', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ eclipse.project.name = 'Debug Debugger'
|
|||
|
||||
dependencies {
|
||||
api project(':Debugger-api')
|
||||
api project(':Framework-AsyncComm')
|
||||
api project(':Framework-TraceModeling')
|
||||
api project(':Base')
|
||||
api project(':ByteViewer')
|
||||
|
@ -35,7 +34,6 @@ dependencies {
|
|||
|
||||
testImplementation project(path: ':Generic', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Base', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Project', configuration: 'testArtifacts')
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import ghidra.app.plugin.core.debug.gui.control.TargetActionTask;
|
|||
import ghidra.app.services.*;
|
||||
import ghidra.app.services.DebuggerControlService.ControlModeChangeListener;
|
||||
import ghidra.async.*;
|
||||
import ghidra.async.AsyncConfigFieldCodec.BooleanAsyncConfigFieldCodec;
|
||||
import ghidra.debug.api.control.ControlMode;
|
||||
import ghidra.debug.api.platform.DebuggerPlatformMapper;
|
||||
import ghidra.debug.api.target.Target;
|
||||
|
@ -51,6 +50,7 @@ import ghidra.framework.main.DataTreeDialog;
|
|||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.AutoConfigState.BooleanAsyncConfigFieldCodec;
|
||||
import ghidra.framework.plugintool.annotation.AutoConfigStateField;
|
||||
import ghidra.framework.plugintool.annotation.AutoServiceConsumed;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
MODULE FILE LICENSE: lib/protobuf-java-3.21.8.jar BSD-3-GOOGLE
|
|
@ -1 +0,0 @@
|
|||
# Framework-AsyncComm
|
|
@ -1,57 +0,0 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
apply from: "${rootProject.projectDir}/gradle/javaProject.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle"
|
||||
apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle"
|
||||
|
||||
apply plugin: 'eclipse'
|
||||
eclipse.project.name = 'Debug Framework-AsyncComm'
|
||||
|
||||
dependencies {
|
||||
api 'com.google.protobuf:protobuf-java:3.21.8'
|
||||
api project(':Generic')
|
||||
api project(':Graph')
|
||||
api project(':ProposedUtils')
|
||||
}
|
||||
|
||||
task genTestPy(type: JavaExec) {
|
||||
ext.outDir = "build/testpy"
|
||||
outputs.dir(outDir)
|
||||
classpath(sourceSets["main"].runtimeClasspath)
|
||||
classpath(sourceSets["test"].runtimeClasspath)
|
||||
mainClass = "ghidra.comm.util.pyexport.GeneratePython"
|
||||
args("ghidra.comm.tests.packet", outDir)
|
||||
doLast {
|
||||
println("NOTE: It is normal to see some export errors, since some classes are intentionally broken to test error detection")
|
||||
}
|
||||
}
|
||||
|
||||
task combineTestPySources(type: Copy) {
|
||||
from(genTestPy)
|
||||
from("src/main/py")
|
||||
from("src/test/py")
|
||||
into("build/fulltestpy")
|
||||
}
|
||||
|
||||
// NOTE: This is defunct, and I don't care
|
||||
task pyTest(type: Exec) {
|
||||
inputs.files(combineTestPySources)
|
||||
|
||||
commandLine("python")
|
||||
workingDir(inputs.files.singleFile)
|
||||
args("-m", "ghidra.comm.test_packet")
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
##VERSION: 2.0
|
||||
##MODULE IP: BSD-3-GOOGLE
|
||||
Module.manifest||GHIDRA||||END|
|
||||
README.md||GHIDRA||||END|
|
|
@ -1,52 +0,0 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.async;
|
||||
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.AutoConfigState.BooleanConfigFieldCodec;
|
||||
import ghidra.framework.plugintool.AutoConfigState.ConfigFieldCodec;
|
||||
|
||||
public interface AsyncConfigFieldCodec {
|
||||
static class GenericAsyncConfigFieldCodec<T>
|
||||
implements ConfigFieldCodec<AsyncReference<T, ?>> {
|
||||
private ConfigFieldCodec<T> codec;
|
||||
|
||||
public GenericAsyncConfigFieldCodec(ConfigFieldCodec<T> codec) {
|
||||
this.codec = codec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncReference<T, ?> read(SaveState state, String name,
|
||||
AsyncReference<T, ?> current) {
|
||||
current.set(codec.read(state, name, current.get()), null);
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(SaveState state, String name, AsyncReference<T, ?> value) {
|
||||
codec.write(state, name, value.get());
|
||||
}
|
||||
}
|
||||
|
||||
static class BooleanAsyncConfigFieldCodec
|
||||
extends GenericAsyncConfigFieldCodec<Boolean> {
|
||||
public BooleanAsyncConfigFieldCodec() {
|
||||
super(BooleanConfigFieldCodec.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Other types as needed
|
||||
}
|
|
@ -26,7 +26,6 @@ dependencies {
|
|||
api project(':SoftwareModeling')
|
||||
api project(':Emulation')
|
||||
api project(':ProposedUtils')
|
||||
api project(':Framework-AsyncComm') // for AsyncReference
|
||||
annotationProcessor project(':AnnotationValidator')
|
||||
|
||||
testImplementation project(':Base')
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
MODULE FILE LICENSE: lib/protobuf-java-3.21.8.jar BSD-3-GOOGLE
|
|
@ -24,6 +24,7 @@ eclipse.project.name = 'Debug ProposedUtils'
|
|||
// val autoServiceVersion = "1.0-rc5"
|
||||
|
||||
dependencies {
|
||||
api 'com.google.protobuf:protobuf-java:3.21.8'
|
||||
api project(':DB')
|
||||
api project(':Project')
|
||||
api project(':SoftwareModeling')
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
##VERSION: 2.0
|
||||
##MODULE IP: BSD-3-GOOGLE
|
||||
Module.manifest||GHIDRA||||END|
|
||||
README.md||GHIDRA||||END|
|
||||
build.gradle||GHIDRA||||END|
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.nio.file.Path;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.async.AsyncReference;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.annotation.AutoConfigStateField;
|
||||
import ghidra.framework.plugintool.annotation.AutoConfigStateField.DefaultConfigFieldCodec;
|
||||
|
@ -372,6 +373,36 @@ public interface AutoConfigState {
|
|||
}
|
||||
}
|
||||
|
||||
static class GenericAsyncConfigFieldCodec<T>
|
||||
implements ConfigFieldCodec<AsyncReference<T, ?>> {
|
||||
private ConfigFieldCodec<T> codec;
|
||||
|
||||
public GenericAsyncConfigFieldCodec(ConfigFieldCodec<T> codec) {
|
||||
this.codec = codec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncReference<T, ?> read(SaveState state, String name,
|
||||
AsyncReference<T, ?> current) {
|
||||
current.set(codec.read(state, name, current.get()), null);
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(SaveState state, String name, AsyncReference<T, ?> value) {
|
||||
codec.write(state, name, value.get());
|
||||
}
|
||||
}
|
||||
|
||||
static class BooleanAsyncConfigFieldCodec
|
||||
extends GenericAsyncConfigFieldCodec<Boolean> {
|
||||
public BooleanAsyncConfigFieldCodec() {
|
||||
super(BooleanConfigFieldCodec.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Other async types as needed
|
||||
|
||||
class ConfigStateField<T> {
|
||||
private static final Map<Class<?>, ConfigFieldCodec<?>> CODECS_BY_TYPE = new HashMap<>();
|
||||
private static final Map<Class<?>, ConfigFieldCodec<?>> CODECS_BY_SPEC = new HashMap<>();
|
||||
|
|
|
@ -28,7 +28,6 @@ dependencies {
|
|||
// Oof. Apparently, this doesn't work transitively....
|
||||
testImplementation project(path: ':Generic', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':ProposedUtils', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':SystemEmulation', configuration: 'testArtifacts')
|
||||
|
|
|
@ -26,13 +26,15 @@ import java.util.stream.Collectors;
|
|||
/**
|
||||
* A fence that completes when all participating futures complete
|
||||
*
|
||||
* <p>
|
||||
* This provides an alternative shorthand for Java's
|
||||
* {@link CompletableFuture#thenAcceptBoth(CompletionStage, BiConsumer)} or
|
||||
* {@link CompletableFuture#allOf(CompletableFuture...)}.
|
||||
*
|
||||
* <p>
|
||||
* Example:
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* public CompletableFuture<Void> processAll(List<Integer> list) {
|
||||
* AsyncFence fence = new AsyncFence();
|
||||
* for (int entry : list) {
|
||||
|
@ -40,7 +42,7 @@ import java.util.stream.Collectors;
|
|||
* }
|
||||
* return fence.ready();
|
||||
* }
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*/
|
||||
public class AsyncFence {
|
||||
private final ArrayList<CompletableFuture<?>> participants = new ArrayList<>();
|
|
@ -67,7 +67,6 @@ dependencies {
|
|||
|
||||
testImplementation project(path: ':ProposedUtils', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Debugger-rmi-trace', configuration: 'testArtifacts')
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ dependencies {
|
|||
testImplementation project(path: ':GnuDemangler', configuration: 'testArtifacts')
|
||||
|
||||
testImplementation project(path: ':Framework-TraceModeling', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
|
||||
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue