use of com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread in project binnavi by google.
the class CDebuggerSynchronizerTest method testRemoveBreakpoint_Disabled.
@SuppressWarnings("unchecked")
@Test
public void testRemoveBreakpoint_Disabled() {
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_456_SET);
breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_456_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DISABLED);
mockDebugger.getProcessManager().addThread(new TargetProcessThread(123, ThreadState.SUSPENDED));
debuggerSynchronizer.receivedEvent(new BreakpointsRemovedReply(0, 0, Lists.newArrayList(new Pair<RelocatedAddress, Integer>(CommonTestObjects.BP_ADDRESS_456_RELOC, 0))));
assertEquals(0, listener.exception);
assertEquals(1, breakpointManager.getNumberOfBreakpoints(BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread in project binnavi by google.
the class CDebuggerSynchronizerTest method testRegisterValues_Malformed.
@Test
public void testRegisterValues_Malformed() {
mockDebugger.getProcessManager().addThread(new TargetProcessThread(123, ThreadState.RUNNING));
NaviLogger.setLevel(Level.OFF);
try {
debuggerSynchronizer.receivedEvent(new RegistersReply(0, 0, RegisterValuesParser.parse("Hannes".getBytes())));
fail();
} catch (final MessageParserException exception) {
CUtilityFunctions.logException(exception);
} finally {
NaviLogger.setLevel(Level.SEVERE);
}
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread in project binnavi by google.
the class CDebuggerSynchronizerTest method testResume_Wellformed.
@Test
public void testResume_Wellformed() throws MaybeNullException {
breakpointManager.addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_456_SET);
breakpointManager.setBreakpointStatus(CommonTestObjects.BP_ADDRESS_456_SET, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_HIT);
final TargetProcessThread thread = new TargetProcessThread(123, ThreadState.RUNNING);
mockDebugger.getProcessManager().addThread(thread);
mockDebugger.getProcessManager().setActiveThread(thread);
debuggerSynchronizer.receivedEvent(new ResumeReply(0, 0));
assertEquals(0, listener.exception);
assertNull(mockDebugger.getProcessManager().getActiveThread());
assertEquals(ThreadState.RUNNING, mockDebugger.getProcessManager().getThread(123).getState());
assertEquals(BreakpointStatus.BREAKPOINT_ACTIVE, breakpointManager.getBreakpointStatus(CommonTestObjects.BP_ADDRESS_456, BreakpointType.REGULAR));
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread in project binnavi by google.
the class CMemorySectionPanelSynchronizerTest method testReceiveTargetInformation.
@Test
public void testReceiveTargetInformation() 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);
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));
debugger.connect();
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setTargetInformation(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)));
assertTrue(m_sectionBox.isEnabled());
debugger.getProcessManager().setTargetInformation(new TargetInformation(32, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false)));
assertFalse(m_sectionBox.isEnabled());
m_synchronizer.dispose();
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread in project binnavi by google.
the class CMemorySectionPanelSynchronizerTest method testThreads.
@Test
public void testThreads() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
debugger.getProcessManager().setAttached(true);
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));
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.RUNNING);
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_sectionBox.isEnabled());
debugger.getProcessManager().addThread(thread);
assertFalse(m_sectionBox.isEnabled());
debugger.getProcessManager().setActiveThread(thread);
assertTrue(m_sectionBox.isEnabled());
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_sectionBox.isEnabled());
debugger.getProcessManager().removeThread(thread);
assertFalse(m_sectionBox.isEnabled());
debugger.getProcessManager().setAttached(false);
m_synchronizer.dispose();
debugger.close();
}
Aggregations