GP-0: Fix DebuggerRegistersProviderGuestTest

This commit is contained in:
Dan 2023-07-24 10:36:37 -04:00
parent bece81176e
commit c98e2b9126
3 changed files with 12 additions and 13 deletions

View File

@ -1022,23 +1022,23 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
return;
}
TraceMemoryManager mem = current.getTrace().getMemoryManager();
AddressSetView guestRegs = platform.getLanguage().getRegisterAddresses();
AddressSetView hostRegs = platform.mapGuestToHost(guestRegs);
AddressSetView viewKnownMem = view.getViewport()
.unionedAddresses(snap -> mem.getAddressesWithState(snap,
platform.mapGuestToHost(platform.getLanguage().getRegisterAddresses()),
.unionedAddresses(snap -> mem.getAddressesWithState(snap, hostRegs,
state -> state == TraceMemoryState.KNOWN));
AddressSpace regSpace = current.getPlatform().getAddressFactory().getRegisterSpace();
AddressSpace regSpace = platform.getAddressFactory().getRegisterSpace();
if (regSpace == null) {
viewKnown = new AddressSet(viewKnownMem);
return;
}
TraceMemorySpace regs = getRegisterMemorySpace(regSpace, false);
TraceMemorySpace regs = getRegisterMemorySpace(current, regSpace, false);
if (regs == null) {
viewKnown = new AddressSet(viewKnownMem);
return;
}
AddressSetView hostRegs =
platform.mapGuestToHost(platform.getLanguage().getRegisterAddresses());
AddressSetView overlayRegs = TraceRegisterUtils.getOverlaySet(regSpace, hostRegs);
AddressSetView overlayRegs =
TraceRegisterUtils.getOverlaySet(regs.getAddressSpace(), hostRegs);
AddressSetView viewKnownRegs = view.getViewport()
.unionedAddresses(snap -> regs.getAddressesWithState(snap, overlayRegs,
state -> state == TraceMemoryState.KNOWN));
@ -1049,7 +1049,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter
if (viewKnown == null) {
return false;
}
TraceMemorySpace regs = getRegisterMemorySpace(register.getAddressSpace(), false);
TraceMemorySpace regs = getRegisterMemorySpace(current, register.getAddressSpace(), false);
if (regs == null && register.getAddressSpace().isRegisterSpace()) {
return false;
}

View File

@ -320,8 +320,7 @@ public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerG
waitForSwing();
mb.testBank1.writeRegister("pc", new byte[] { 0x00, 0x40, 0x00, 0x00 });
waitOn(mb.testModel.flushEvents());
waitForDomainObject(recorder.getTrace());
waitRecorder(recorder);
RegisterRow rowL = findRegisterRow(pc);
waitForPass(() -> assertTrue(rowL.isKnown()));

View File

@ -384,14 +384,14 @@ public class DBTraceGuestPlatform extends DBAnnotatedObject
while (it.hasNext()) {
Pair<DBTraceGuestPlatformMappedRange, AddressRange> next = it.next();
DBTraceGuestPlatformMappedRange entry = next.getLeft();
AddressRange hostRange = next.getRight();
result.add(entry.mapGuestToHost(hostRange));
AddressRange guestRange = next.getRight();
result.add(entry.mapGuestToHost(guestRange));
}
return result;
}
/**
* Map the an address only if the entire range is contained in a single mapped range
* Map an address only if the entire range is contained in a single mapped range
*
* @param guestMin the min address of the range to map
* @param guestMax the max address of the range to check