use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBookmarkTableModel method getBookmarkDescription.
/**
* Finds the bookmark description 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 description of the bookmark in the given row.
*/
private String getBookmarkDescription(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).getDescription();
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBookmarkTableModel method setBookmarkDescription.
/**
* Modifies the bookmark description of the bookmark displayed in the given row.
*
* @param row The row of the bookmark.
* @param description The new description of the bookmark.
*/
private void setBookmarkDescription(final int row, final String description) {
final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(m_debuggerProvider, row);
final BookmarkManager manager = bookmarkTriple.second();
final int index = bookmarkTriple.third();
manager.getBookmark(index).setDescription(description);
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBookmarkTableHelpers method findBookmark.
/**
* Returns the corresponding bookmark manager and index for a row in the bookmarks table.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param row The row of the bookmark table.
*
* @return The bookmark manager/bookmark index pair for the bookmark in the given row.
*/
public static Triple<IDebugger, BookmarkManager, Integer> findBookmark(final BackEndDebuggerProvider debuggerProvider, final int row) {
Preconditions.checkNotNull(debuggerProvider, "IE01322: Debugger provider argument can't be null");
Preconditions.checkArgument(row >= 0, "IE01323: Row arguments can not be negative");
int bookmarks = 0;
for (final IDebugger debugger : debuggerProvider.getDebuggers()) {
if ((row >= bookmarks) && (row < bookmarks + debugger.getBookmarkManager().getNumberOfBookmarks())) {
return Triple.make(debugger, debugger.getBookmarkManager(), row - bookmarks);
} else {
bookmarks += debugger.getBookmarkManager().getNumberOfBookmarks();
}
}
throw new IllegalArgumentException("IE01324: Invalid row number");
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CBookmarkFunctions method deleteBookmarks.
/**
* Deletes a list of bookmarks.
*
* @param provider Contains the debuggers where bookmarks can be set.
* @param rows The rows of the bookmarks to delete.
*/
public static void deleteBookmarks(final BackEndDebuggerProvider provider, final int[] rows) {
Preconditions.checkNotNull(provider, "IE01329: Provider argument can not be null");
Preconditions.checkNotNull(rows, "IE01330: Rows argument can not be null");
final ArrayList<Pair<BookmarkManager, CBookmark>> bookmarks = new ArrayList<Pair<BookmarkManager, CBookmark>>();
for (final int row : rows) {
final Triple<IDebugger, BookmarkManager, Integer> bookmarkTriple = CBookmarkTableHelpers.findBookmark(provider, row);
final BookmarkManager manager = bookmarkTriple.second();
final int index = bookmarkTriple.third();
bookmarks.add(Pair.make(manager, manager.getBookmark(index)));
}
for (final Pair<BookmarkManager, CBookmark> p : bookmarks) {
p.first().removeBookmark(p.second());
}
}
use of com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger in project binnavi by google.
the class CRegisterMenuProvider method getRegisterMenu.
@Override
public JPopupMenu getRegisterMenu(final int registerNumber) {
final IDebugger debugger = m_debugPerspectiveModel.getCurrentSelectedDebugger();
if (debugger == null) {
return null;
}
final JPopupMenu menu = new JPopupMenu();
final BigInteger value = m_dataProvider.getRegisterInformation(registerNumber).getValue();
menu.add(CActionProxy.proxy(new CCopyRegisterValueAction(value.toString(16).toUpperCase())));
final MemorySection section = ProcessHelpers.getSectionWith(debugger.getProcessManager().getMemoryMap(), new CAddress(value));
final JMenuItem gotoAddress = menu.add(CActionProxy.proxy(new CGotoOffsetAction(m_debugPerspectiveModel, new CAddress(value))));
gotoAddress.setEnabled(section != null);
if (containsAddress(m_debugPerspectiveModel.getGraphModel().getGraph().getRawView(), value.longValue())) {
menu.add(CActionProxy.proxy(new CZoomToAddressAction(m_debugPerspectiveModel.getGraphModel().getGraph(), new CAddress(value), debugger.getModule(new RelocatedAddress(new CAddress(value))))));
} else {
final IViewContainer container = m_debugPerspectiveModel.getGraphModel().getViewContainer();
menu.add(CActionProxy.proxy(new CSearchAction(m_debugPerspectiveModel.getGraphModel().getParent(), container, new CAddress(value))));
}
return menu;
}
Aggregations