use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress in project binnavi by google.
the class MemoryModuleTest method testConstructor.
@Test
public void testConstructor() {
final com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule internalModule = new com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule("dll", "C:\\dll", new RelocatedAddress(new CAddress(0x100)), 0x200);
final MemoryModule module = new MemoryModule(internalModule);
assertEquals("dll", module.getName());
assertEquals(0x100, module.getBaseAddress().toLong());
assertEquals(0x200, module.getSize());
}
use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress in project binnavi by google.
the class ProcessTest method testModules.
@Test
public void testModules() {
final MockProcessListener listener = new MockProcessListener();
final ProcessManager manager = new ProcessManager();
manager.addModule(new MemoryModule("Hannes", "C:\\Hannes.dll", new RelocatedAddress(new CAddress(0x100)), 0x100));
final Process process = new Process(manager);
assertEquals(1, process.getModules().size());
process.addListener(listener);
final MemoryModule dll = new MemoryModule("Foobert.dll", "C:\\Foobert.dll", new RelocatedAddress(new CAddress(0x100)), 0x100);
manager.addModule(dll);
assertEquals("addedModule/Foobert.dll;", listener.events);
assertEquals(2, process.getModules().size());
manager.removeModule(dll);
assertEquals("addedModule/Foobert.dll;removedModule/Foobert.dll;", listener.events);
assertEquals(1, process.getModules().size());
process.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress in project binnavi by google.
the class ThreadTest method testGetCurrentAddress.
@Test
public void testGetCurrentAddress() {
final MockThreadListener listener = new MockThreadListener();
m_thread.addListener(listener);
m_internalThread.setCurrentAddress(new RelocatedAddress(new CAddress(0x200)));
assertEquals("changedProgramCounter;", listener.events);
assertEquals(0x200, m_thread.getCurrentAddress().toLong());
m_thread.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress in project binnavi by google.
the class CBreakpointModuleSynchronizer method isWithinModule.
/**
* Checks whether the given breakpoint is within the boundaries of the specified module.
*
* @param module The module against which the breakpoint is tested.
* @param breakpoint The breakpoint to be tested.
* @return True of the breakpoint is within the given module, false otherwise.
*/
private static boolean isWithinModule(final IDebugger debugger, final MemoryModule module, final Breakpoint breakpoint) {
final RelocatedAddress bpAddress = debugger.fileToMemory(breakpoint.getAddress().getModule(), breakpoint.getAddress().getAddress());
final boolean addressOk = (bpAddress.getAddress().toBigInteger().compareTo(module.getBaseAddress().getAddress().toBigInteger()) >= 0) && (bpAddress.getAddress().toBigInteger().compareTo(module.getBaseAddress().getAddress().toBigInteger().add(BigInteger.valueOf(module.getSize()))) <= 0);
return addressOk && (module.getName().compareToIgnoreCase(breakpoint.getAddress().getModule().getConfiguration().getName()) == 0);
}
use of com.google.security.zynamics.binnavi.disassembly.RelocatedAddress in project binnavi by google.
the class SingleStepParser method parseSuccess.
@Override
public SingleStepReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
final long tid = parseThreadId();
final RelocatedAddress address = new RelocatedAddress(parseAddress());
try {
final RegisterValues registerValues = RegisterValuesParser.parse(parseData());
return new SingleStepReply(packetId, 0, tid, address, registerValues);
} catch (final MessageParserException e) {
return new SingleStepReply(packetId, PARSER_ERROR, tid, address, null);
}
}
Aggregations