use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CGraphDebugger method toggleBreakpoint.
/**
* Sets a breakpoint on an address or removes a breakpoint from an address.
*
* @param manager The breakpoint manager used to set or remove the breakpoint.
* @param module The module where the breakpoint is set or removed.
* @param unrelocatedAddress The unrelocated address where the breakpoint is set or removed.
*/
public static void toggleBreakpoint(final BreakpointManager manager, final INaviModule module, final UnrelocatedAddress unrelocatedAddress) {
Preconditions.checkNotNull(manager, "IE01716: Manager argument can not be null");
Preconditions.checkNotNull(module, "IE01717: Module argument can not be null");
Preconditions.checkNotNull(unrelocatedAddress, "IE01718: Address argument can not be null");
final BreakpointAddress address = new BreakpointAddress(module, unrelocatedAddress);
if (manager.hasBreakpoint(BreakpointType.REGULAR, address)) {
removeBreakpoints(Sets.newHashSet(address), manager);
} else {
manager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(address));
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CEventTableModel method getValueAt.
@Override
public Object getValueAt(final int row, final int col) {
final ITraceEvent debugEvent = getEvents().get(row);
final BreakpointAddress address = debugEvent.getOffset();
switch(col) {
case INDEX_COLUMN:
return row + 1;
case THREAD_COLUMN:
return Long.valueOf(debugEvent.getThreadId());
case MODULE_COLUMN:
return address.getModule() == null ? "-" : address.getModule().getConfiguration().getName();
case ADDRESS_COLUMN:
{
if (address.getModule() == null) {
return address.getAddress().getAddress().toHexString();
} else {
final INaviFunction function = address.getModule().isLoaded() ? address.getModule().getContent().getFunctionContainer().getFunction(address.getAddress().getAddress()) : null;
if (function == null) {
return address.getAddress().getAddress().toHexString();
} else {
return function.getName();
}
}
}
default:
throw new IllegalStateException("IE01121: Unknown column");
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointModuleSynchronizer method processModuleBreakpoints.
private static void processModuleBreakpoints(final IDebugger debugger, final MemoryModule module, final BreakpointType breakPointType, final IModuleBreakpointEnumerator callback) {
final BreakpointManager manager = debugger.getBreakpointManager();
final Set<BreakpointAddress> breakpointAddresses = new HashSet<BreakpointAddress>();
for (final Breakpoint breakpoint : manager.getBreakpointsByModule(breakPointType, module)) {
if ((manager.getBreakpointStatus(breakpoint.getAddress(), breakpoint.getType()) != BreakpointStatus.BREAKPOINT_ENABLED) && (manager.getBreakpointStatus(breakpoint.getAddress(), breakpoint.getType()) != BreakpointStatus.BREAKPOINT_DISABLED) && isWithinModule(debugger, module, breakpoint)) {
breakpointAddresses.add(breakpoint.getAddress());
}
}
callback.handleAddress(manager, breakpointAddresses);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointRemoveFunctions method removeAll.
/**
* Removes all breakpoints of a given breakpoint manager.
*
* @param manager The breakpoints manager whose breakpoints are removed.
*/
private static void removeAll(final BreakpointManager manager) {
final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
for (final Breakpoint breakpoint : manager.getBreakpoints(BreakpointType.REGULAR)) {
addresses.add(breakpoint.getAddress());
}
CGraphDebugger.removeBreakpoints(addresses, manager);
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointTable method showPopupMenu.
/**
* Displays the popup menu at the location specified by the click event.
*
* @param event The click event.
*/
private void showPopupMenu(final MouseEvent event) {
final int row = rowAtPoint(event.getPoint());
final int column = columnAtPoint(event.getPoint());
int[] rows = getSelectedRows();
if ((rows.length == 0) || (rows.length == 1)) {
changeSelection(row, column, false, false);
rows = getSelectedRows();
}
final JPopupMenu menu = new JPopupMenu();
menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteAction(m_debuggerProvider, rows))));
if (CBreakpointFunctions.allDisabled(m_debuggerProvider, rows)) {
menu.add(new JMenuItem(CActionProxy.proxy(new CEnableAction(m_debuggerProvider, rows))));
} else if (CBreakpointFunctions.allNotDisabled(m_debuggerProvider, rows)) {
menu.add(new JMenuItem(CActionProxy.proxy(new CDisableAction(m_debuggerProvider, rows))));
}
if (rows.length == 1) {
menu.addSeparator();
final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, rows[0]);
final BreakpointManager manager = breakpoint.first().getBreakpointManager();
final int breakpointIndex = breakpoint.second();
final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress();
menu.add(new JMenuItem(CActionProxy.proxy(new CZoomBreakpointAction(SwingUtilities.windowForComponent(this), m_graph, m_viewContainer, address))));
}
menu.show(event.getComponent(), event.getX(), event.getY());
}
Aggregations