use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointRemoveFunctions method disableAllView.
/**
* Disables all breakpoints which are part of a view.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param view The view to consider when disabling the breakpoints.
*/
public static void disableAllView(final BackEndDebuggerProvider debuggerProvider, final INaviView view) {
Preconditions.checkNotNull(debuggerProvider, "IE01889: Debugger provider argument can not be null");
Preconditions.checkNotNull(view, "IE02009: View argument can't be null");
for (final IDebugger debugger : debuggerProvider) {
final BreakpointManager manager = debugger.getBreakpointManager();
final Set<BreakpointAddress> addressesToDisable = new HashSet<BreakpointAddress>();
for (int i = 0; i < manager.getNumberOfBreakpoints(BreakpointType.REGULAR); i++) {
final BreakpointAddress address = manager.getBreakpoint(BreakpointType.REGULAR, i).getAddress();
if (CViewHelpers.containsAddress(view, address.getAddress())) {
addressesToDisable.add(address);
}
}
manager.setBreakpointStatus(addressesToDisable, BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DISABLED);
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointRemoveFunctions method deleteBreakpoints.
/**
* Deletes the breakpoints specified by the rows argument.
*
* @param debuggerProvider Provides the debuggers where breakpoints can be set.
* @param rows Rows that identify the breakpoints.
*/
public static void deleteBreakpoints(final BackEndDebuggerProvider debuggerProvider, final int[] rows) {
Preconditions.checkNotNull(debuggerProvider, "IE01886: Debugger provider argument can not be null");
Preconditions.checkNotNull(rows, "IE02253: Rows argument can't be null");
final ArrayList<Pair<IDebugger, BreakpointAddress>> addresses = new ArrayList<Pair<IDebugger, BreakpointAddress>>();
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();
addresses.add(new Pair<IDebugger, BreakpointAddress>(breakpoint.first(), manager.getBreakpoint(BreakpointType.REGULAR, breakpointIndex).getAddress()));
}
for (final Pair<IDebugger, BreakpointAddress> p : addresses) {
final BreakpointManager manager = p.first().getBreakpointManager();
final BreakpointAddress address = p.second();
manager.setBreakpointStatus(Sets.newHashSet(address), BreakpointType.REGULAR, BreakpointStatus.BREAKPOINT_DELETING);
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointPainter method paintBreakpoints.
/**
* Paints breakpoints into a function node.
*
* @param manager The breakpoint manager that provides breakpoint information.
* @param node The visible BinNavi node where the breakpoint is painted.
* @param functionNode The function node that contains the raw data for the BinNavi node.
*/
public static void paintBreakpoints(final BreakpointManager manager, final NaviNode node, final INaviFunctionNode functionNode) {
Preconditions.checkNotNull(manager, "IE02374: Manager argument can not be null");
Preconditions.checkNotNull(node, "IE02375: Node argument can not be null");
Preconditions.checkNotNull(functionNode, "IE02376: Code node argument can not be null");
final INaviFunction function = functionNode.getFunction();
final INaviModule module = function.getModule();
final int FUNCTION_BREAKPOINT_LINE = 1;
final BreakpointAddress address = new BreakpointAddress(module, new UnrelocatedAddress(function.getAddress()));
if (manager.hasBreakpoint(BreakpointType.REGULAR, address)) {
node.setHighlighting(CHighlightLayers.BREAKPOINT_LAYER, FUNCTION_BREAKPOINT_LINE, BreakpointManager.getBreakpointColor(manager.getBreakpointStatus(address, BreakpointType.REGULAR)));
} else {
// If there is no breakpoint, clear potential older breakpoint line.
node.clearHighlighting(500, FUNCTION_BREAKPOINT_LINE);
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class CBreakpointPainter method paintBreakpoints.
/**
* Paints breakpoints into code nodes.
*
* @param manager The breakpoint manager that provides breakpoint information.
* @param node The visible BinNavi node where the breakpoint is painted.
* @param codeNode The code node that contains the raw data for the BinNavi node.
*/
public static void paintBreakpoints(final BreakpointManager manager, final NaviNode node, final INaviCodeNode codeNode) {
Preconditions.checkNotNull(manager, "IE02171: Manager argument can not be null");
Preconditions.checkNotNull(node, "IE02172: Node argument can not be null");
Preconditions.checkNotNull(codeNode, "IE02173: Code node argument can not be null");
for (final INaviInstruction instruction : codeNode.getInstructions()) {
final BreakpointAddress address = new BreakpointAddress(instruction.getModule(), new UnrelocatedAddress(instruction.getAddress()));
final int line = CCodeNodeHelpers.instructionToLine(codeNode, instruction);
if (manager.hasBreakpoint(BreakpointType.REGULAR, address)) {
// Only the address is highlighted when breakpoints are set on instructions
// visible in code nodes.
final int addressCharacters = address.getAddress().getAddress().toHexString().length();
node.setHighlighting(CHighlightLayers.BREAKPOINT_LAYER, line, 0, addressCharacters, BreakpointManager.getBreakpointColor(manager.getBreakpointStatus(address, BreakpointType.REGULAR)));
} else {
// If there is no breakpoint, clear potential older breakpoint line.
node.clearHighlighting(CHighlightLayers.BREAKPOINT_LAYER, line);
}
}
}
use of com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress in project binnavi by google.
the class PostgreSQLProviderTest method testTraceFunctionsSave1.
@Test
public void testTraceFunctionsSave1() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final INaviProject project = getProvider().createProject("SOME_PROJECT");
getProvider().createTrace(project, "SOME_TRACE", "SOME_TRACE_DESCRIPTION");
project.load();
final TraceList trace = project.getContent().getTraces().get(0);
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final long tid = 0x1L;
final UnrelocatedAddress address2 = new UnrelocatedAddress(new CAddress(0x1234));
final BreakpointAddress address = new BreakpointAddress(module, address2);
final TraceEventType type = TraceEventType.ECHO_BREAKPOINT;
final List<TraceRegister> values = new ArrayList<>();
final ITraceEvent event = new TraceEvent(tid, address, type, values);
trace.addEvent(event);
trace.setDescription("burzelbarf");
PostgreSQLTraceFunctions.save((AbstractSQLProvider) getProvider(), trace);
project.close();
INaviProject project2 = null;
for (final INaviProject cProject : getProvider().loadProjects()) {
if (cProject.getConfiguration().getId() == project.getConfiguration().getId()) {
project2 = cProject;
}
}
getProvider().createTrace(project2, "SOME_TRACE_2", "SOME_TRACE_DESCRIPTION_2");
project2.load();
final TraceList trace2 = project2.getContent().getTraces().get(0);
assertEquals("burzelbarf", trace2.getDescription());
}
Aggregations