Search in sources :

Example 66 with MockDebugger

use of com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger in project binnavi by google.

the class CMemoryRefreshButtonSynchronizerTest method testReceiveTargetInformation.

@Test
public void testReceiveTargetInformation() throws DebugExceptionWrapper {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    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, false, false, true, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
    assertFalse(m_refreshButton.isEnabled());
    assertEquals(m_defaultAction, m_refreshButton.getAction());
    debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, 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_refreshButton.isEnabled());
    assertEquals(m_askAction, m_refreshButton.getAction());
    m_synchronizer.dispose();
    debugger.close();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) RegisterDescription(com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription) TargetInformation(com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation) ArrayList(java.util.ArrayList) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) TargetInformationReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply) Test(org.junit.Test)

Example 67 with MockDebugger

use of com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger in project binnavi by google.

the class CDebuggerSynchronizerTest method setUp.

@Before
public void setUp() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
    mockDebugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    mockDebugger.setAddressTranslator(CommonTestObjects.MODULE, new CAddress(0), new CAddress(0x1000));
    breakpointManager = mockDebugger.getBreakpointManager();
    debuggerSynchronizer = new DebuggerSynchronizer(mockDebugger);
    debuggerSynchronizer.addListener(listener);
    // assign the synchronizer to the internally used one by the debugger so we can test the
    // synchronizer itself
    // as well as the combination of synchronizer and debugger
    final Field synchronizerField = AbstractDebugger.class.getDeclaredField("synchronizer");
    synchronizerField.setAccessible(true);
    synchronizerField.set(mockDebugger, debuggerSynchronizer);
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) DebuggerSynchronizer(com.google.security.zynamics.binnavi.debug.debugger.synchronizers.DebuggerSynchronizer) Field(java.lang.reflect.Field) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Before(org.junit.Before)

Aggregations

MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)67 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)65 Test (org.junit.Test)60 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)47 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)20 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)18 TargetInformation (com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation)18 RegisterDescription (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription)17 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)16 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)16 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)16 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)16 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)16 ArrayList (java.util.ArrayList)16 MemoryMapReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.MemoryMapReply)15 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)15 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)15 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)11 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)10 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)9