use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class PathFinderTest method setUp.
@Before
public void setUp() throws IOException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, InvalidExporterDatabaseFormatException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException, InvalidDatabaseVersionException, LoadCancelledException {
final String[] parts = CConfigLoader.loadPostgreSQL();
final CDatabase database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
final Database db = new Database(database);
database.connect();
database.load();
final MockSqlProvider provider = new MockSqlProvider();
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));
m_notepad = new Module(db, database.getContent().getModule(1), nodeTagManager, viewTagManager);
m_notepad.load();
m_kernel32 = new Module(db, database.getContent().getModule(2), nodeTagManager, viewTagManager);
m_kernel32.load();
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class TraceLoggerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, InvalidDatabaseVersionException {
final SQLProvider mockProvider = new MockSqlProvider();
// CDatabase("", "", "", "", "", false,
final IDatabase internalDatabase = new MockDatabase();
// false);
final Database database = new Database(internalDatabase);
database.load();
final MockProject mockProject = new MockProject();
final ITreeNode<CTag> nodeRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, mockProvider));
final Tree<CTag> nodeTagTree = new Tree<CTag>(nodeRootNode);
final TagManager nodeTagManager = new TagManager(new CTagManager(nodeTagTree, TagType.NODE_TAG, mockProvider));
final ITreeNode<CTag> viewRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, mockProvider));
final Tree<CTag> viewTagTree = new Tree<CTag>(viewRootNode);
final TagManager viewTagManager = new TagManager(new CTagManager(viewTagTree, TagType.VIEW_TAG, mockProvider));
final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
final Project project = new Project(database, mockProject, nodeTagManager, viewTagManager);
m_mockModule = new Module(database, mockModule, viewTagManager, nodeTagManager);
m_debugSettings = new ModuleTargetSettings(m_mockModule.getNative());
m_mockDebugger = new MockDebugger(m_debugSettings);
m_mockDebugger.setAddressTranslator(mockModule, new CAddress(0), new CAddress(0x1000));
final Debugger debugger = new Debugger(m_mockDebugger);
m_logger = new TraceLogger(debugger, module);
m_projectLogger = new TraceLogger(debugger, project);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class BreakpointManagerTest method testGetBreakpoint.
@Test
public void testGetBreakpoint() {
try {
apiManager.getBreakpoint(null, null);
fail();
} catch (final NullPointerException exception) {
}
try {
apiManager.getBreakpoint(null, new Address(0x123));
fail();
} catch (final NullPointerException exception) {
}
apiManager.setBreakpoint(module, new Address(0x123));
final Breakpoint breakpoint = apiManager.getBreakpoint(module, new Address(0x123));
assertEquals(0x123, breakpoint.getAddress().toLong());
final Module module = ModuleFactory.get();
apiManager.setBreakpoint(module, new Address(0x123));
assertTrue(apiManager.hasBreakpoint(module, new Address(0x123)));
final Breakpoint breakpoint2 = apiManager.getBreakpoint(module, new Address(0x123));
assertEquals(0x123, breakpoint2.getAddress().toLong());
apiManager.removeBreakpoint(module, new Address(0x123));
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class DebuggerTest method testRelocation5.
@Test(expected = NullPointerException.class)
public void testRelocation5() {
final INaviModule nativeModule = new MockModule();
final Module module = ModuleFactory.get(nativeModule);
debugger.toFilebase(module, null);
fail();
}
use of com.google.security.zynamics.binnavi.API.disassembly.Module in project binnavi by google.
the class DebuggerTest method testRelocation3.
@Test(expected = NullPointerException.class)
public void testRelocation3() {
final INaviModule nativeModule = new MockModule();
final Module module = ModuleFactory.get(nativeModule);
debugger.toImagebase(module, null);
}
Aggregations