use of com.google.security.zynamics.binnavi.disassembly.Modules.CModule in project binnavi by google.
the class ModuleTest method setUp.
@Before
public void setUp() throws FileReadException, CouldntLoadDataException, LoadCancelledException {
ConfigManager.instance().read();
final MockSqlProvider provider = new MockSqlProvider();
final Date creationDate = new Date();
final Date modificationDate = new Date();
final CModule internalModule = new CModule(123, "Name", "Comment", creationDate, modificationDate, "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
internalModule.load();
final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
final Database db = new Database(new MockDatabase());
m_module = new Module(db, internalModule, nodeTagManager, viewTagManager);
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModule in project binnavi by google.
the class AddressSpaceTest method setUp.
@Before
public void setUp() {
final MockSqlProvider provider = new MockSqlProvider();
creationDate = new Date();
modificationDate = new Date();
final MockDatabase mockDb = new MockDatabase();
database = new Database(mockDb);
internalAddressSpace = new CAddressSpace(1, "Mock Space", "Mock Space Description", creationDate, modificationDate, new LinkedHashMap<INaviModule, IAddress>(), null, provider, new MockProject());
addressSpace = new AddressSpace(database, null, internalAddressSpace);
final Date creationDate = new Date();
final Date modificationDate = new Date();
final CModule internalModule = new CModule(123, "Name", "Comment", creationDate, modificationDate, "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
mockDb.getContent().addModule(internalModule);
final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
module = new Module(database, internalModule, nodeTagManager, viewTagManager);
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModule in project binnavi by google.
the class AddressSpaceTest method testConstructorAlternative.
@Test
public void testConstructorAlternative() throws com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException, LoadCancelledException {
final MockSqlProvider provider = new MockSqlProvider();
final MockDatabase mockDb = new MockDatabase(provider);
final Database database = new Database(mockDb);
final com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate template = new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "", "", 0, provider);
mockDb.getContent().getDebuggerTemplateManager().addDebugger(template);
final CModule internalModule = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
mockDb.getContent().addModule(internalModule);
final CAddressSpace internalAddressSpace = new CAddressSpace(1, "Mock Space", "Mock Space Description", new Date(), new Date(), new LinkedHashMap<INaviModule, IAddress>(), null, provider, new MockProject());
internalAddressSpace.load();
internalAddressSpace.getConfiguration().setDebuggerTemplate(template);
internalAddressSpace.getContent().addModule(internalModule);
final Project project = ProjectFactory.get();
final AddressSpace addressSpace = new AddressSpace(database, project, internalAddressSpace);
assertEquals(1, addressSpace.getModules().size());
assertNotNull(addressSpace.getDebuggerTemplate());
assertNotNull(addressSpace.getDebugger());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModule in project binnavi by google.
the class ViewTest method testCreateCodeNode.
@Test
public void testCreateCodeNode() throws PartialLoadException, com.google.security.zynamics.binnavi.API.disassembly.CouldntLoadDataException {
final MockViewListener listener = new MockViewListener();
m_view.addListener(listener);
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, m_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, m_provider);
final Function function = new Function(module, parentFunction);
final List<Instruction> instructions = Lists.newArrayList(new Instruction(new MockInstruction()));
m_view.load();
final CodeNode node = m_view.createCodeNode(function, instructions);
assertEquals(node, m_view.getGraph().getNodes().get(0));
assertEquals(listener.events, "addedNode;changedGraphType;");
assertEquals(com.google.security.zynamics.binnavi.API.disassembly.GraphType.Flowgraph, m_view.getGraphType());
m_view.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModule in project binnavi by google.
the class CodeNodeTest method setUp.
@Before
public void setUp() {
final Database database = new Database(new MockDatabase());
final MockModule mockModule = new MockModule();
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 Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
final MockView mockView = new MockView();
final View view = new View(module, mockView, nodeTagManager, viewTagManager);
final MockSqlProvider 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, provider), null, Integer.MAX_VALUE, false, provider);
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 CComment m_globalComment = new CComment(null, CommonTestObjects.TEST_USER_1, null, "Global Comment");
final INaviCodeNode codeNode = new CCodeNode(0, 0, 0, 0, 0, Color.RED, Color.RED, false, false, Lists.<IComment>newArrayList(m_globalComment), internalFunction, new HashSet<CTag>(), new MockSqlProvider());
codeNode.addInstruction(new CInstruction(true, internalModule, new CAddress(0x123), "nop", new ArrayList<COperandTree>(), new byte[] { (byte) 0x90 }, "x86-32", provider), null);
m_node = new CodeNode(view, codeNode, nodeTagManager);
}
Aggregations