mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-0: GDB Diagnostics, debugger framework test fixes.
This commit is contained in:
parent
5808049c83
commit
9fa2a722d8
4 changed files with 18 additions and 3 deletions
|
@ -720,6 +720,10 @@ public class GdbManagerImpl implements GdbManager {
|
|||
curCmd = pcmd;
|
||||
}
|
||||
//Msg.debug(this, "CURCMD = " + curCmd);
|
||||
if (LOG_IO) {
|
||||
DBG_LOG.println("*CMD: " + cmd.getClass());
|
||||
DBG_LOG.flush();
|
||||
}
|
||||
String text = cmd.encode();
|
||||
if (text != null) {
|
||||
Interpreter interpreter = cmd.getInterpreter();
|
||||
|
|
|
@ -759,6 +759,11 @@ public class DBTraceMemorySpace implements Unfinished, TraceMemorySpace, DBTrace
|
|||
protected Address doFindBytesInRange(long snap, AddressRange range, ByteBuffer data,
|
||||
ByteBuffer mask, boolean forward, TaskMonitor monitor) {
|
||||
int len = data.capacity();
|
||||
assert len != 0; // Caller should have checked
|
||||
if (range.getLength() > 0 /*treat length unsigned*/ && range.getLength() < len) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AddressRange rangeOfStarts =
|
||||
new AddressRangeImpl(range.getMinAddress(), range.getMaxAddress().subtract(len - 1));
|
||||
ByteBuffer read = ByteBuffer.allocate(len);
|
||||
|
@ -790,7 +795,8 @@ public class DBTraceMemorySpace implements Unfinished, TraceMemorySpace, DBTrace
|
|||
if (mask != null && mask.capacity() != len) {
|
||||
throw new IllegalArgumentException("data and mask must have same capacity");
|
||||
}
|
||||
if (len == 0 || range.getLength() > 0 && range.getLength() < len) {
|
||||
if (len == 0 ||
|
||||
range.getLength() > 0 /*treat length unsigned*/ && range.getLength() < len) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ public class TracePcodeEmulatorTest extends AbstractGhidraHeadlessIntegrationTes
|
|||
"bx r6")); // 4 bytes
|
||||
|
||||
byte[] mov = asm.assembleLine(tb.addr(0x00401000),
|
||||
"mov r0, #123", thumbPat); // #123 is decimal
|
||||
"movs r0, #123", thumbPat); // #123 is decimal
|
||||
try (UndoableTransaction tid = tb.startTransaction()) {
|
||||
asm.patchProgram(mov, tb.addr(0x00401000));
|
||||
}
|
||||
|
|
|
@ -719,7 +719,7 @@ public abstract class AbstractDBTraceMemoryManagerTest
|
|||
@Test
|
||||
public void testFindBytes() {
|
||||
try (UndoableTransaction tid = UndoableTransaction.start(trace, "Testing", true)) {
|
||||
assertEquals(4, memory.putBytes(3, addr(0x4000), buf(1, 2, 3, 4)));
|
||||
assertEquals(5, memory.putBytes(3, addr(0x4000), buf(1, 2, 3, 4, 5)));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -750,6 +750,11 @@ public abstract class AbstractDBTraceMemoryManagerTest
|
|||
memory.findBytes(3, range(0x4001, 0x4004), buf(1, 2, 3, 4), buf(-1, -1, -1, -1),
|
||||
true, TaskMonitor.DUMMY));
|
||||
|
||||
// Too high, into unknown
|
||||
assertNull(
|
||||
memory.findBytes(3, range(0x4001, 0x4005), buf(1, 2, 3, 4, 5), buf(-1, -1, -1, -1, -1),
|
||||
true, TaskMonitor.DUMMY));
|
||||
|
||||
// Too low
|
||||
assertNull(
|
||||
memory.findBytes(3, range(0x3fff, 0x4002), buf(1, 2, 3, 4), buf(-1, -1, -1, -1),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue