Search in sources :

Example 21 with ModuleTargetSettings

use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.

the class CMemoryViewerSynchronizerTest method testActiveDebugger.

@Test
public void testActiveDebugger() {
    final IGraphModel graphModel = new MockGraphModel();
    final CDebugPerspectiveModel model = new CDebugPerspectiveModel(graphModel);
    final JHexView hexView = new JHexView();
    final CMemoryProvider provider = new CMemoryProvider();
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
    model.setActiveDebugger(debugger);
    final CMemoryViewerSynchronizer synchronizer = new CMemoryViewerSynchronizer(hexView, provider, model);
    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))));
    assertEquals(AddressMode.BIT32, hexView.getAddressMode());
    debugger.connection.m_synchronizer.receivedEvent(new TargetInformationReply(0, 0, new TargetInformation(64, new FilledList<RegisterDescription>(), new DebuggerOptions(false, false, false, false, false, false, false, false, false, false, 1, 0, new ArrayList<DebuggerException>(), false, false, false))));
    assertEquals(AddressMode.BIT64, hexView.getAddressMode());
    synchronizer.dispose();
}
Also used : CDebugPerspectiveModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.Panels.CDebugPerspectiveModel) JHexView(com.google.security.zynamics.zylib.gui.JHexPanel.JHexView) IGraphModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.IGraphModel) ArrayList(java.util.ArrayList) DebuggerOptions(com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) 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) TargetInformationReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply) MockGraphModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.MockGraphModel) Test(org.junit.Test)

Example 22 with ModuleTargetSettings

use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.

the class CDumpAllWaiterTest method testSuccess.

@Test
public void testSuccess() 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, 0, new CAddress(0x300), new byte[] { 0x50, 0x50, 0x50, 0x50 }));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertTrue(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 23 with ModuleTargetSettings

use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.

the class CDumpAllWaiterTest method testDetach.

@Test
public void testDetach() 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 DetachReply(0, 0));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertTrue(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) DetachReply(com.google.security.zynamics.binnavi.debug.connection.packets.replies.DetachReply) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 24 with ModuleTargetSettings

use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.

the class CDumpAllWaiterTest method testCloseRequested.

@Test
public void testCloseRequested() 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);
    waiter.closeRequested();
    Thread.sleep(250);
    debugger.close();
    assertFalse(waiter.isAlive());
    assertTrue(waiter.success());
}
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) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 25 with ModuleTargetSettings

use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.

the class CSearchWaiterTest method testSuccess.

@Test
public void testSuccess() 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, 0, new CAddress(0x300)));
    Thread.sleep(250);
    assertFalse(waiter.isAlive());
    assertNotNull(waiter.getReply());
    assertTrue(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)

Aggregations

ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)73 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)65 Test (org.junit.Test)63 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)51 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)21 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)20 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)20 ArrayList (java.util.ArrayList)19 DebuggerOptions (com.google.security.zynamics.binnavi.debug.models.targetinformation.DebuggerOptions)18 TargetInformation (com.google.security.zynamics.binnavi.debug.models.targetinformation.TargetInformation)18 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)17 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)17 RegisterDescription (com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterDescription)17 TargetInformationReply (com.google.security.zynamics.binnavi.debug.connection.packets.replies.TargetInformationReply)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 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)14 Breakpoint (com.google.security.zynamics.binnavi.debug.models.breakpoints.Breakpoint)11 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)10