use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class StepBreakpointHitSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final StepBreakpointHitReply reply) {
final BreakpointManager manager = getDebugger().getBreakpointManager();
final ProcessManager processManager = getDebugger().getProcessManager();
RelocatedAddress breakpointAddress = null;
final RegisterValues registerValues = reply.getRegisterValues();
final long tid = reply.getThreadId();
for (final ThreadRegisters threadRegisters : registerValues) {
if (tid == threadRegisters.getTid()) {
for (final RegisterValue registerValue : threadRegisters) {
if (registerValue.isPc()) {
breakpointAddress = new RelocatedAddress(new CAddress(registerValue.getValue()));
break;
}
}
}
}
manager.clearBreakpointsPassive(BreakpointType.STEP);
try {
final TargetProcessThread thread = processManager.getThread(tid);
for (final ThreadRegisters threadRegisters : registerValues) {
if (tid == threadRegisters.getTid()) {
// Update the thread with the new register values.
thread.setRegisterValues(threadRegisters.getRegisters());
}
}
processManager.setActiveThread(thread);
thread.setCurrentAddress(breakpointAddress);
} catch (final MaybeNullException exception) {
// Apparently there is no thread with the specified TID.
// This is not necessarily an error because the thread might have
// been closed while this handler was active.
// Nevertheless this should be logged.
NaviLogger.info("Error: Process manager could not get thread. Exception %s", exception);
return;
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class EchoBreakpointHitSynchronizer method handleSuccess.
@Override
protected void handleSuccess(final EchoBreakpointHitReply reply) {
final BreakpointManager manager = getDebugger().getBreakpointManager();
final long tid = reply.getThreadId();
for (final ThreadRegisters threadRegisters : reply.getRegisterValues()) {
if (tid == threadRegisters.getTid()) {
for (final RegisterValue registerValue : threadRegisters) {
if (registerValue.isPc()) {
final RelocatedAddress address = new RelocatedAddress(new CAddress(registerValue.getValue()));
manager.setBreakpointStatus(Sets.newHashSet(DebuggerHelpers.getBreakpointAddress(getDebugger(), address)), BreakpointType.ECHO, BreakpointStatus.BREAKPOINT_HIT);
break;
}
}
}
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager 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());
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class CBreakpointTableModel method getBreakpointAddress.
/**
* Determines the address of the breakpoint shown in a given row.
*
* @param row The row where the breakpoint is shown.
*
* @return The address of the breakpoint shown in the given row.
*/
private IAddress getBreakpointAddress(final int row) {
final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, row);
final BreakpointManager manager = breakpoint.first().getBreakpointManager();
final int breakpointIndex = breakpoint.second();
return manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress().getAddress().getAddress();
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointManager in project binnavi by google.
the class CBreakpointTableModel method getBreakpointCondition.
/**
* Returns the breakpoint condition for the breakpoint in the given row.
*
* @param row Row index of the breakpoint.
*
* @return Formula string of the breakpoint condition.
*/
private String getBreakpointCondition(final int row) {
final Pair<IDebugger, Integer> breakpoint = CBreakpointTableHelpers.findBreakpoint(m_debuggerProvider, row);
final BreakpointManager manager = breakpoint.first().getBreakpointManager();
final int breakpointIndex = breakpoint.second();
final Condition condition = manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getCondition();
return condition == null ? "" : condition.toString();
}
Aggregations