Search in sources :

Example 61 with MockDebugger

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

the class CMemoryViewerSynchronizerTest method setUp.

@Before
public void setUp() {
    final IGraphModel graphModel = new MockGraphModel();
    m_model = new CDebugPerspectiveModel(graphModel);
    final CMemoryProvider provider = new CMemoryProvider();
    m_hexView.setData(provider);
    m_synchronizer = new CMemoryViewerSynchronizer(m_hexView, provider, m_model);
    m_debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    m_model.setActiveDebugger(m_debugger);
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) CDebugPerspectiveModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.Panels.CDebugPerspectiveModel) IGraphModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphModel) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) MockGraphModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.MockGraphModel) Before(org.junit.Before)

Example 62 with MockDebugger

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

the class CDumpAllWaiterTest method testFailure.

@Test
public void testFailure() throws Exception {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.connect();
    final CDumpAllWaiter waiter = new CDumpAllWaiter(debugger, new CAddress(0x300), 0x100);
    waiter.start();
    new Thread() {

        @Override
        public void run() {
            try {
                waiter.runExpensiveCommand();
            } catch (final Exception e) {
            }
        }
    }.start();
    Thread.sleep(250);
    debugger.connection.m_synchronizer.receivedEvent(new ReadMemoryReply(0, 3, null, null));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertFalse(waiter.success());
    debugger.close();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) CDumpAllWaiter(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CDumpAllWaiter) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) ReadMemoryReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.ReadMemoryReply) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 63 with MockDebugger

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

the class CSearchWaiterTest method testCloseRequested.

@Test
public void testCloseRequested() throws Exception {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.connect();
    final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
    waiter.start();
    new Thread() {

        @Override
        public void run() {
            try {
                waiter.runExpensiveCommand();
            } catch (final Exception e) {
            }
        }
    }.start();
    Thread.sleep(250);
    waiter.closeRequested();
    Thread.sleep(250);
    debugger.close();
    assertFalse(waiter.isAlive());
    assertNull(waiter.getReply());
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) CSearchWaiter(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 64 with MockDebugger

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

the class CSearchWaiterTest method testFailure.

@Test
public void testFailure() throws Exception {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.connect();
    final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
    waiter.start();
    new Thread() {

        @Override
        public void run() {
            try {
                waiter.runExpensiveCommand();
            } catch (final Exception e) {
            }
        }
    }.start();
    Thread.sleep(250);
    debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 3, null));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertNotNull(waiter.getReply());
    assertFalse(waiter.getReply().success());
    debugger.close();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) SearchReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.SearchReply) CSearchWaiter(com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 65 with MockDebugger

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

the class CMemoryRefreshButtonSynchronizerTest method testThreads.

@Test
public void testThreads() throws DebugExceptionWrapper {
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    debugger.connect();
    debugger.getProcessManager().setAttached(true);
    final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.RUNNING);
    m_model.setActiveDebugger(debugger);
    debugger.getProcessManager().setActiveThread(null);
    assertFalse(m_refreshButton.isEnabled());
    debugger.getProcessManager().addThread(thread);
    assertFalse(m_refreshButton.isEnabled());
    debugger.getProcessManager().setActiveThread(thread);
    assertTrue(m_refreshButton.isEnabled());
    debugger.getProcessManager().setActiveThread(null);
    assertFalse(m_refreshButton.isEnabled());
    debugger.getProcessManager().removeThread(thread);
    assertFalse(m_refreshButton.isEnabled());
    debugger.getProcessManager().setAttached(false);
    m_synchronizer.dispose();
    debugger.close();
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) TargetProcessThread(com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) Test(org.junit.Test)

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