use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class BreakpointHelpersTest method testGetEchoBreakpointsView.
@Test
public void testGetEchoBreakpointsView() {
assertTrue(BreakpointHelpers.getEchoBreakpoints(m_debugger, m_view).isEmpty());
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x1234)))));
m_debugger.getBreakpointManager().getNative().addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(m_module, new UnrelocatedAddress(new CAddress(0x123)))));
final List<Address> breakpoints = BreakpointHelpers.getEchoBreakpoints(m_debugger, m_view);
assertEquals(2, breakpoints.size());
assertEquals(0x1234, breakpoints.get(0).toLong());
assertEquals(0x123, breakpoints.get(1).toLong());
try {
BreakpointHelpers.getEchoBreakpoints(null, m_view);
fail();
} catch (final NullPointerException exception) {
}
try {
BreakpointHelpers.getEchoBreakpoints(m_debugger, (View) null);
fail();
} catch (final NullPointerException exception) {
}
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class BreakpointManagerTest method testAddMultipleNative.
@Test
public void testAddMultipleNative() {
internalManager.addBreakpoints(BreakpointType.ECHO, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertTrue(apiManager.hasEchoBreakpoint(module, new Address(0x124)));
internalManager.clearBreakpointsPassive(BreakpointType.ECHO);
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class BreakpointManagerTest method testRemoveBreakpoint.
@Test
public void testRemoveBreakpoint() {
try {
apiManager.removeBreakpoint(null, null);
fail();
} catch (final NullPointerException exception) {
}
apiManager.setBreakpoint(module, new Address(0x123));
apiManager.setBreakpoint(module, new Address(0x124));
apiManager.addListener(mockListener);
apiManager.removeBreakpoint(module, new Address(0x123));
internalManager.removeBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(CommonTestObjects.MODULE, new UnrelocatedAddress(new CAddress(0x124)))));
assertEquals("removedBreakpoint/124;", mockListener.events);
assertEquals(1, apiManager.getBreakpoints().size());
apiManager.removeListener(mockListener);
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class FunctionNodeTest method testConstructor.
@Test
public void testConstructor() {
final Database database = new Database(new MockDatabase());
final TagManager nodeTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.NODE_TAG));
final TagManager viewTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));
final MockSqlProvider provider = new MockSqlProvider();
final CModule internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, provider);
final Module module = new Module(database, internalModule, nodeTagManager, viewTagManager);
final MockView mockView = new MockView();
final View view = new View(module, mockView, nodeTagManager, viewTagManager);
final CFunction internalFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
final CFunctionNode internalFunctionNode = new CFunctionNode(0, internalFunction, 0, 0, 0, 0, Color.RED, false, false, null, new HashSet<CTag>(), provider);
final CFunction parentFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
final Function function = new Function(module, parentFunction);
final FunctionNode node = new FunctionNode(view, internalFunctionNode, function, viewTagManager);
assertEquals(function, node.getFunction());
assertEquals("Function Node ['Mock Function']", node.toString());
}
use of com.google.security.zynamics.zylib.disassembly.CAddress in project binnavi by google.
the class FunctionTest method setUp.
@Before
public void setUp() {
m_provider = new MockSqlProvider();
final CModule internalModule = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), null, Integer.MAX_VALUE, false, m_provider);
m_internalFunction = new CFunction(internalModule, MockView.getFullView(m_provider, com.google.security.zynamics.zylib.disassembly.ViewType.Native, null), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
m_internalFunction2 = new CFunction(internalModule, MockView.getFullView(m_provider, com.google.security.zynamics.zylib.disassembly.ViewType.Native, null), new CAddress(0x124), "Mock Function 2", "Mock Function 2", "Mock Description 2", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
}
Aggregations