GP-80: Add Dynamic bytes (raw memory) viewer

This commit is contained in:
Dan
2021-09-27 10:40:40 -04:00
parent a1dba97a10
commit 48ba18306e
54 changed files with 5937 additions and 2330 deletions

View File

@@ -15,6 +15,7 @@
*/
package ghidra.dbg.model;
import java.nio.ByteBuffer;
import java.util.function.Function;
import ghidra.program.model.address.Address;
@@ -55,6 +56,18 @@ public class TestDebuggerModelBuilder {
return testModel.range(min, max);
}
public byte[] arr(int... e) {
byte[] result = new byte[e.length];
for (int i = 0; i < e.length; i++) {
result[i] = (byte) e[i];
}
return result;
}
public ByteBuffer buf(int... e) {
return ByteBuffer.wrap(arr(e));
}
public void createTestProcessesAndThreads() {
testProcess1 = testModel.addProcess(1);
testThread1 = testProcess1.addThread(1);

View File

@@ -40,11 +40,15 @@ public class TestTargetMemory
), "Initialized");
}
public void getMemory(Address address, byte[] data) {
assertEquals(getModel().ram, address.getAddressSpace());
memory.getData(address.getOffset(), data);
}
@Override
public CompletableFuture<byte[]> readMemory(Address address, int length) {
assertEquals(getModel().ram, address.getAddressSpace());
byte[] data = new byte[length];
memory.getData(address.getOffset(), data);
getMemory(address, data);
CompletableFuture<byte[]> future = getModel().future(data);
future.thenAccept(__ -> {
listeners.fire.memoryUpdated(this, address, data);