use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CMemoryViewerSynchronizerTest method testSwitchDebuggers.
@Test
public void testSwitchDebuggers() throws DebugExceptionWrapper {
m_debugger.connect();
m_debugger.getProcessManager().setAttached(true);
m_debugger.getProcessManager().setMemoryMap(new MemoryMap(Lists.newArrayList(new MemorySection(new CAddress(0x100), new CAddress(0x1FF)))));
m_model.setActiveMemoryAddress(new CAddress(0x100), false);
assertEquals(0x100, m_hexView.getCurrentOffset());
assertEquals(0x100, m_hexView.getData().getDataLength());
final IDebugger debugger2 = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger2.connect();
debugger2.getProcessManager().setMemoryMap(new MemoryMap(Lists.newArrayList(new MemorySection(new CAddress(0x10), new CAddress(0x50)))));
m_model.setActiveDebugger(debugger2);
assertEquals(0x10, m_hexView.getCurrentOffset());
assertEquals(0x41, m_hexView.getData().getDataLength());
m_debugger.getProcessManager().setAttached(false);
m_synchronizer.dispose();
debugger2.close();
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CDebugPerspectiveModel method setActiveDebugger.
/**
* Sets the active debugger.
*
* @param debugger The new debugger.
*/
public void setActiveDebugger(final IDebugger debugger) {
if (m_activeDebugger == debugger) {
return;
}
if ((debugger != null) && !m_eventLoggerMap.containsKey(debugger)) {
m_notifierMap.put(debugger, new CDebugEventNotifier(m_model.getParent(), debugger, m_model.getDebuggerProvider().getDebugTarget(), m_model.getViewContainer()));
m_eventLoggerMap.put(debugger, new TraceLogger(m_model.getViewContainer().getTraceProvider(), debugger));
}
final IDebugger oldDebugger = m_activeDebugger;
m_activeDebugger = debugger;
for (final IDebugPerspectiveModelListener listener : m_listeners) {
// ESCA-JAVA0166: Calling a listener
try {
listener.changedActiveDebugger(oldDebugger, m_activeDebugger);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CGraphDebugger method toggleBreakpoint.
/**
* Sets or removes a breakpoint at a given line of a code node.
*
* @param debuggerProvider Debugger provider that contains all possible debuggers for the code
* node.
* @param codeNode The code node where the breakpoint is set.
* @param row The code node row where the breakpoint is set.
*/
public static void toggleBreakpoint(final BackEndDebuggerProvider debuggerProvider, final INaviCodeNode codeNode, final int row) {
Preconditions.checkNotNull(debuggerProvider, "IE01719: Debugger provider argument can not be null");
Preconditions.checkNotNull(codeNode, "IE01720: Code node argument can not be null");
final INaviInstruction instruction = CCodeNodeHelpers.lineToInstruction(codeNode, row);
if (instruction == null) {
return;
}
final IDebugger debugger = getDebugger(debuggerProvider, instruction);
if (debugger == null) {
return;
}
toggleBreakpoint(debugger.getBreakpointManager(), instruction.getModule(), new UnrelocatedAddress(instruction.getAddress()));
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CFollowInDumpMenu method addFollowInDumpMenu.
/**
* Adds the menu that follow in dump menu for the clicked instruction.
*
* @param menu The code node menu that is extended.
* @param model The graph model that provides information about the graph.
* @param node The node whose menu is created.
* @param clickedObject The object that was clicked.
* @param y The y-coordinate of the click.
*/
public static void addFollowInDumpMenu(final JPopupMenu menu, final CGraphModel model, final NaviNode node, final Object clickedObject, final double y) {
Preconditions.checkNotNull(menu, "IE02371: menu argument can not be null");
Preconditions.checkNotNull(model, "IE02372: model argument can not be null");
Preconditions.checkNotNull(node, "IE02373: node argument can not be null");
final int line = node.positionToRow(y);
if (line == -1) {
return;
}
final INaviCodeNode codeNode = (INaviCodeNode) node.getRawNode();
final INaviInstruction instruction = CCodeNodeHelpers.lineToInstruction(codeNode, line);
if (instruction != null) {
final IDebugger debugger = CGraphDebugger.getDebugger(model.getDebuggerProvider(), instruction);
if ((debugger != null) && (clickedObject instanceof COperandTreeNode)) {
final TargetProcessThread activeThread = debugger.getProcessManager().getActiveThread();
if (activeThread != null) {
final CDebugPerspectiveModel viewModel = (CDebugPerspectiveModel) model.getGraphPanel().getViewModel().getModel(PerspectiveType.DebugPerspective);
final COperandTreeNode treeNode = (COperandTreeNode) clickedObject;
final boolean added = addFollowInDumpMenu(menu, viewModel, debugger, activeThread, instruction.getModule(), treeNode);
if (added) {
menu.addSeparator();
}
}
}
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBookmarkTableModel method getBookmarkAddress.
/**
* Finds the bookmark address of the bookmark that is displayed in a given row of the table.
*
* @param row The table row where the bookmark is displayed.
*
* @return The bookmark address of the bookmark in the given row.
*/
private String getBookmarkAddress(final int row) {
final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(m_debuggerProvider, row);
final BookmarkManager manager = bookmarkTriple.second();
final int index = bookmarkTriple.third();
return manager.getBookmark(index).getAddress().toHexString();
}
Aggregations