use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CSearchWaiterTest method testDetach.
@Test
public void testDetach() 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 DetachReply(0, 0));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNull(waiter.getReply());
debugger.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CMemoryRefreshButtonSynchronizerTest method testSwitchDebugger.
@Test
public void testSwitchDebugger() throws DebugExceptionWrapper {
final TargetProcessThread thread = new TargetProcessThread(0x666, ThreadState.RUNNING);
final MemoryModule module = new MemoryModule("narf.exe", "C:\\zort\\narf.exe", new RelocatedAddress(new CAddress(0x1000)), 123345);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
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))));
debugger.connection.m_synchronizer.receivedEvent(new ProcessStartReply(0, 0, new ProcessStart(thread, module)));
final MockDebugger debugger2 = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger2.connect();
debugger2.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))));
debugger2.connection.m_synchronizer.receivedEvent(new ProcessStartReply(0, 0, new ProcessStart(thread, module)));
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setActiveThread(thread);
assertTrue(m_refreshButton.isEnabled());
assertEquals(m_defaultAction, m_refreshButton.getAction());
m_model.setActiveDebugger(debugger2);
debugger2.getProcessManager().setActiveThread(thread);
assertTrue(m_refreshButton.isEnabled());
assertEquals(m_askAction, m_refreshButton.getAction());
m_synchronizer.dispose();
debugger.close();
debugger2.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CBoookmarkFunctionsTest method test2DeleteBookmarks.
@Test
public void test2DeleteBookmarks() {
final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
final CBookmark bookmark = new CBookmark(new MockAddress(), "foo");
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
debuggerProvider.addDebugger(debugger);
final BookmarkManager bookmarkManager = debugger.getBookmarkManager();
bookmarkManager.addBookmark(bookmark);
assertEquals(1, bookmarkManager.getNumberOfBookmarks());
final int[] rows = { 0 };
CBookmarkFunctions.deleteBookmarks(debuggerProvider, rows);
assertEquals(0, bookmarkManager.getNumberOfBookmarks());
model.dispose();
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CBreakpointTableModelTest method test6Utility.
@Test
public void test6Utility() {
final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, BREAKPOINT_ADDRESS_SET);
final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, BREAKPOINT_ADDRESS);
@SuppressWarnings("unused") final CAddress address = new CAddress(0);
final BaseNode root = new BaseNode();
final BreakpointCondition bpCondition = new BreakpointCondition("foo", root);
breakPoint.setCondition(bpCondition);
breakPoint.setDescription("purzel");
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(7, tableModel.getColumnCount());
assertEquals("Status", tableModel.getColumnName(0));
assertEquals("Debugger", tableModel.getColumnName(1));
assertEquals("Unrelocated Address", tableModel.getColumnName(2));
assertEquals("Relocated Address", tableModel.getColumnName(3));
assertEquals("Module", tableModel.getColumnName(4));
assertEquals("Condition", tableModel.getColumnName(5));
assertEquals("Description", tableModel.getColumnName(6));
assertEquals(1, tableModel.getRowCount());
}
use of com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings in project binnavi by google.
the class CBreakpointFunctionsTest method test6removeFunctions.
@Test
public void test6removeFunctions() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final MockFunction mockFunction = new MockFunction();
final INaviModule mockModule = mockFunction.getModule();
CFunctionContainerHelper.addFunction(mockModule.getContent().getFunctionContainer(), mockFunction);
final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234)))));
@SuppressWarnings("unused") final Breakpoint breakPoint = debugger.getBreakpointManager().getBreakpoint(BreakpointType.REGULAR, new BreakpointAddress(mockModule, new UnrelocatedAddress(new CAddress(0x1234))));
debuggerProvider.addDebugger(debugger);
final CBreakpointTableModel tableModel = new CBreakpointTableModel(debuggerProvider);
assertEquals(1, tableModel.getRowCount());
final IFilledList<Pair<IDebugger, INaviFunction>> targets = new FilledList<Pair<IDebugger, INaviFunction>>();
final Pair<IDebugger, INaviFunction> targetPair = new Pair<IDebugger, INaviFunction>(debugger, mockFunction);
targets.add(targetPair);
assertEquals(1, targets.size());
CBreakpointRemoveFunctions.removeBreakpoints(targets);
@SuppressWarnings("unused") final BreakpointManager manager = debugger.getBreakpointManager();
assertEquals(0, tableModel.getRowCount());
}
Aggregations