use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap in project binnavi by google.
the class CRegisterViewSynchronizerTest method testDetach.
@Test
public void testDetach() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.SUSPENDED);
debugger.getProcessManager().addThread(thread);
debugger.getProcessManager().setActiveThread(thread);
debugger.connect();
m_model.setActiveDebugger(debugger);
debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, true, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
final MemorySection section1 = new MemorySection(new CAddress(0x100), new CAddress(0x1FF));
final MemorySection section2 = new MemorySection(new CAddress(0x300), new CAddress(0x3FF));
final MemoryMap memoryMap = new MemoryMap(Lists.newArrayList(section1, section2));
debugger.connection.m_synchronizer.receivedEvent(new MemoryMapReply(0, 0, memoryMap));
assertTrue(m_registerView.isEnabled());
debugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
assertFalse(m_registerView.isEnabled());
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap in project binnavi by google.
the class ReplySynchronizer method resetTargetProcess.
/**
* Resets information about the target process.
*/
protected void resetTargetProcess() {
final BreakpointManager manager = debugger.getBreakpointManager();
final ProcessManager processManager = debugger.getProcessManager();
debugger.setTerminated();
manager.clearBreakpointsPassive(BreakpointType.ECHO);
manager.clearBreakpointsPassive(BreakpointType.STEP);
deactivateBreakpoints();
processManager.getMemory().clear();
processManager.setMemoryMap(new MemoryMap(new ArrayList<MemorySection>()));
final Collection<TargetProcessThread> threads = processManager.getThreads();
for (final TargetProcessThread thread : threads) {
processManager.removeThread(thread);
}
for (final MemoryModule module : processManager.getModules()) {
processManager.removeModule(module);
}
processManager.setAttached(false);
processManager.setActiveThread(null);
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap in project binnavi by google.
the class CMemoryLoaderTest method setUp.
@Before
public void setUp() {
debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
final ArrayList<MemorySection> sections = new ArrayList<MemorySection>();
sections.add(new MemorySection(new CAddress(BigInteger.ZERO), new CAddress(BigInteger.valueOf(1000))));
debugger.getProcessManager().setMemoryMap(new MemoryMap(sections));
loader = new MemoryLoader(debugger);
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap in project binnavi by google.
the class CDebuggerSynchronizerTest method testMemmap.
@Test
public void testMemmap() {
final IFilledList<MemorySection> sections = new FilledList<MemorySection>();
sections.add(new MemorySection(new CAddress(100), new CAddress(200)));
sections.add(new MemorySection(new CAddress(300), new CAddress(400)));
debuggerSynchronizer.receivedEvent(new MemoryMapReply(0, 0, new MemoryMap(sections)));
assertEquals(0, listener.exception);
assertEquals(2, mockDebugger.getProcessManager().getMemoryMap().getNumberOfSections());
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap in project binnavi by google.
the class MemoryMapParser method parseSuccess.
@Override
public MemoryMapReply parseSuccess(final int packetId, final int argumentCount) throws IOException {
final IAddress[] addresses = new IAddress[argumentCount];
for (int i = 0; i < argumentCount; i++) {
addresses[i] = parseAddress();
}
final List<MemorySection> map = new ArrayList<>();
for (int i = 0; i < addresses.length / 2; i++) {
final IAddress startAddress = addresses[2 * i];
final IAddress endAddress = addresses[2 * i + 1];
map.add(new MemorySection(startAddress, endAddress));
}
return new MemoryMapReply(packetId, 0, new MemoryMap(map));
}
Aggregations