use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress 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.disassembly.UnrelocatedAddress in project binnavi by google.
the class DebuggerHelpers method getBreakpointAddress.
/**
* Converts a memory address into a breakpoint address.
*
* @param debugger The debugger which handles the breakpoint.
* @param memoryAddress The memory address to convert.
*
* @return The breakpoint address.
*/
public static BreakpointAddress getBreakpointAddress(final IDebugger debugger, final RelocatedAddress memoryAddress) {
Preconditions.checkNotNull(debugger, "IE00161: Debugger argument can not be null");
Preconditions.checkNotNull(memoryAddress, "IE00163: Memory address argument can not be null");
final INaviModule module = debugger.getModule(memoryAddress);
return new BreakpointAddress(module, module == null ? new UnrelocatedAddress(memoryAddress.getAddress()) : debugger.memoryToFile(module, memoryAddress));
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class BreakpointManagerTest method testSetBreakpoint.
@Test
public void testSetBreakpoint() {
apiManager.addListener(mockListener);
try {
apiManager.setBreakpoint(null, null);
} catch (final NullPointerException exception) {
}
apiManager.setBreakpoint(module, new Address(0x123));
assertEquals("addedBreakpoint/123;", mockListener.events);
try {
apiManager.setBreakpoint(null, new Address(0x123));
} catch (final NullPointerException exception) {
}
internalManager.addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("addedBreakpoint/123;addedBreakpoint/124;", mockListener.events);
assertTrue(apiManager.hasBreakpoint(module, new Address(0x124)));
apiManager.removeListener(mockListener);
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class BreakpointManagerTest method testSetEchoBreakpoint.
@Test
public void testSetEchoBreakpoint() {
apiManager.addListener(mockListener);
try {
apiManager.setEchoBreakpoint(null, null);
} catch (final NullPointerException exception) {
}
apiManager.setEchoBreakpoint(module, new Address(0x123));
assertEquals("addedEchoBreakpoint/123;", mockListener.events);
try {
apiManager.setEchoBreakpoint(null, new Address(0x123));
} catch (final NullPointerException exception) {
}
internalManager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("addedEchoBreakpoint/123;addedEchoBreakpoint/124;", mockListener.events);
assertTrue(apiManager.hasEchoBreakpoint(module, new Address(0x124)));
apiManager.removeListener(mockListener);
}
use of com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress in project binnavi by google.
the class BreakpointManagerTest method testRemoveEchoBreakpoint.
@Test
public void testRemoveEchoBreakpoint() {
try {
apiManager.removeEchoBreakpoint(null, null);
fail();
} catch (final NullPointerException exception) {
}
apiManager.setEchoBreakpoint(module, new Address(0x123));
apiManager.setEchoBreakpoint(module, new Address(0x124));
apiManager.addListener(mockListener);
apiManager.removeEchoBreakpoint(module, new Address(0x123));
internalManager.removeBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("removedEchoBreakpoint/123;removedEchoBreakpoint/124;", mockListener.events);
assertEquals(0, apiManager.getBreakpoints().size());
apiManager.removeListener(mockListener);
}
Aggregations