mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-80: Add Dynamic bytes (raw memory) viewer
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user