use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBreakpointTableHelpers method findBreakpoint.
/**
* Given a row of the breakpoint table, this function calculates to what breakpoint manager the
* breakpoint of that row belongs to and what index the breakpoint has within the breakpoint
* manager.
*
* @param debuggerProvider The debuggers that are used to fill the breakpoint table.
* @param row A row of the breakpoint table.
*
* @return A pair that contains the breakpoint manager and the breakpoint index of the breakpoint
* identified by the given row.
*
* @throws IllegalArgumentException Thrown if the debugger provider argument is null or the row
* argument is out of bounds.
*/
public static Pair<IDebugger, Integer> findBreakpoint(final BackEndDebuggerProvider debuggerProvider, final int row) {
Preconditions.checkNotNull(debuggerProvider, "IE01336: Debugger provider argument can't be null");
Preconditions.checkArgument(row >= 0, "IE01337: Row arguments can not be negative");
int breakpoints = 0;
for (final IDebugger debugger : debuggerProvider.getDebuggers()) {
if ((row >= breakpoints) && (row < breakpoints + debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR))) {
return new Pair<IDebugger, Integer>(debugger, row - breakpoints);
} else {
breakpoints += debugger.getBreakpointManager().getNumberOfBreakpoints(BreakpointType.REGULAR);
}
}
throw new IllegalArgumentException("IE01338: Invalid row number");
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBreakpointFunctions method allDisabled.
/**
* Tests whether all breakpoints set in the specified rows are disabled.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param rows Rows that identify the breakpoints.
*
* @return True, if all selected breakpoints are disabled. False, otherwise.
*/
public static boolean allDisabled(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
checkArguments(debuggerProvider, rows);
for (final int row : rows) {
final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(debuggerProvider, row);
final BreakpointManager manager = breakpoint.first().getBreakpointManager();
final int breakpointIndex = breakpoint.second();
if (manager.getBreakpointStatus(BreakpointType.REGULAR, breakpointIndex) != BreakpointStatus.BREAKPOINT_DISABLED) {
return false;
}
}
return true;
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CStepIntoHotkeyAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent event) {
final IDebugger debugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
final TargetProcessThread currentThread = debugger == null ? null : debugger.getProcessManager().getActiveThread();
if (currentThread != null && debugger != null) {
CDebuggerFunctions.stepInto(m_parent, debugger);
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CProjectContainer method updateProjectDebuggers.
/**
* Rebuilds the active debuggers from information from the address spaces.
*/
private void updateProjectDebuggers() {
for (final INaviAddressSpace addressSpace : m_project.getContent().getAddressSpaces()) {
final IDebugger debugger = addressSpace.getConfiguration().getDebugger();
if (debugger != null) {
m_activeDebuggers.put(addressSpace, debugger);
m_debuggerProvider.addDebugger(debugger);
}
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CThreadInformationPanelTest method test2.
/**
* This test makes sure that going from no debugger to a debugger to no debugger works fine.
*/
@Test
public void test2() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
// CGraphModelFactory.get(database,
final IGraphModel graphModel = new MockGraphModel();
// viewContainer);
final CDebugPerspectiveModel model = CDebugPerspectiveModelFactory.get(graphModel);
final CThreadInformationPanel panel = new CThreadInformationPanel(model);
final IDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
final TargetProcessThread thread = new TargetProcessThread(0, ThreadState.RUNNING);
debugger.getProcessManager().addThread(thread);
final LinkedHashSet<?> perspectiveListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(model, "m_listeners"), "m_listeners");
final LinkedHashSet<?> debuggerListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ReflectionHelpers.getField(AbstractDebugger.class, debugger, "processManager"), "listeners"), "m_listeners");
final LinkedHashSet<?> threadListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(thread, "listeners"), "m_listeners");
assertEquals(1, perspectiveListeners.size());
assertEquals(1, debuggerListeners.size());
assertEquals(1, threadListeners.size());
model.setActiveDebugger(debugger);
assertEquals(2, threadListeners.size());
assertEquals(2, debuggerListeners.size());
model.setActiveDebugger(null);
assertEquals(1, threadListeners.size());
assertEquals(1, debuggerListeners.size());
assertEquals(1, perspectiveListeners.size());
panel.dispose();
assertEquals(1, threadListeners.size());
assertEquals(1, debuggerListeners.size());
assertEquals(0, perspectiveListeners.size());
}
Aggregations