use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLProviderTest method testSetDescription1.
@Test
public void testSetDescription1() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviProject project = getProvider().loadProjects().get(0);
final CAddressSpace addressSpace = getProvider().createAddressSpace(project, "SOME_OTHER_ADDRESS_SPACE");
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final CFunction function = (CFunction) module.getContent().getFunctionContainer().getFunctions().get(0);
final CView view = (CView) module.getContent().getViewContainer().getViews().get(0);
final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
final ITreeNode<CTag> tag = tagManager.getRootTag().getChildren().get(0);
getProvider().setDescription(addressSpace, "New Description");
getProvider().setDescription(function, "New Description");
getProvider().setDescription(module, "New Description");
getProvider().setDescription(project, "New Description");
getProvider().setDescription(tag.getObject(), "New Description");
getProvider().setDescription(module.getContent().getTraceContainer().getTraces().get(0), "New Description");
getProvider().setDescription(view, "New Description");
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLProviderTestSetup method testCreateViewModule4.
@Test
public void testCreateViewModule4() throws CouldntLoadDataException, CouldntSaveDataException, CPartialLoadException, LoadCancelledException {
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final INaviView view = module.getContent().getViewContainer().getViews().get(223);
view.load();
final CView newView = getProvider().createView(module, view, "Module View Name", "Module View Description");
assertEquals("Module View Name", newView.getName());
assertEquals("Module View Description", newView.getConfiguration().getDescription());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class PostgreSQLProviderTestSetup method testCreateTraceModule4.
@Test
public void testCreateTraceModule4() throws CouldntSaveDataException, CouldntLoadDataException {
final INaviModule module = getProvider().loadModules().get(0);
final TraceList trace = getProvider().createTrace(module, "Trace Name", "Trace Description");
assertEquals("Trace Name", trace.getName());
assertEquals("Trace Description", trace.getDescription());
assertEquals(0, trace.getEventCount());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class CDatabase method load.
@Override
public void load() throws CouldntLoadDataException, InvalidDatabaseVersionException, LoadCancelledException {
Preconditions.checkArgument(isConnected(), "IE00686: Not connected to the database");
try {
if (!loadReporter.report(LoadEvents.LOADING_DATABASE)) {
throw new LoadCancelledException();
}
if (!loadReporter.report(LoadEvents.DETERMINING_DATABASE_VERSION)) {
throw new LoadCancelledException();
}
final DatabaseVersion databaseVersion = provider.getDatabaseVersion();
final DatabaseVersion currentVersion = new DatabaseVersion(Constants.PROJECT_VERSION);
if ((databaseVersion.compareTo(currentVersion) != 0) && currentVersion.needsUpgrading(databaseVersion)) {
throw new InvalidDatabaseVersionException(databaseVersion);
}
if (!loadReporter.report(LoadEvents.LOADING_USERS)) {
throw new LoadCancelledException();
}
loadUserManager();
if (!loadReporter.report(LoadEvents.LOADING_VIEW_TAGS)) {
throw new LoadCancelledException();
}
final CTagManager viewTagManager = loadViewTagManager();
if (!loadReporter.report(LoadEvents.LOADING_NODE_TAGS)) {
throw new LoadCancelledException();
}
final CTagManager nodeTagManager = loadNodeTagManager();
if (!loadReporter.report(LoadEvents.LOADING_DEBUGGERS)) {
throw new LoadCancelledException();
}
final DebuggerTemplateManager debuggerDescriptionManager = provider.loadDebuggers();
if (!loadReporter.report(LoadEvents.LOADING_PROJECTS)) {
throw new LoadCancelledException();
}
final List<INaviProject> projects = provider.loadProjects();
if (!loadReporter.report(LoadEvents.LOADING_RAW_MODULES)) {
throw new LoadCancelledException();
}
final List<INaviRawModule> rawModules = provider.loadRawModules();
if (!loadReporter.report(LoadEvents.LOADING_MODULES)) {
throw new LoadCancelledException();
}
final List<INaviModule> modules = provider.loadModules();
debuggerDescriptionManager.addListener(internalDebuggerTemplateListener);
content = new CDatabaseContent(provider, this, listeners, projects, modules, rawModules, viewTagManager, nodeTagManager, debuggerDescriptionManager);
} catch (final CouldntLoadDataException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
close();
throw exception;
} catch (final InvalidDatabaseVersionException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
throw exception;
} catch (final LoadCancelledException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
close();
throw exception;
} finally {
isLoading = false;
}
content.initializeRawModules(content.getModules(), content.getRawModules());
for (final IDatabaseListener listener : listeners) {
try {
listener.loadedDatabase(this);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
loadReporter.report(LoadEvents.LOADING_FINISHED);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class BreakpointManager method setBreakpoint.
// ! Sets a regular breakpoint.
/**
* Sets a regular breakpoint at the given address.
*
* @param module The module the breakpoint is tied to. This argument can be null.
* @param address The address of the breakpoint.
*
* @return The set breakpoint. Null is returned if no breakpoint was set.
*/
public Breakpoint setBreakpoint(final Module module, final Address address) {
Preconditions.checkNotNull(address, "Error: Address argument can not be null");
final INaviModule realModule = module == null ? null : module.getNative();
final BreakpointAddress breakpointAddress = new BreakpointAddress(realModule, new UnrelocatedAddress(new CAddress(address.toLong())));
final Set<BreakpointAddress> breakpoints = Sets.newHashSet(breakpointAddress);
breakpointManager.addBreakpoints(BreakpointType.REGULAR, breakpoints);
return echoBreakpointMap.get(breakpointManager.getBreakpoint(BreakpointType.REGULAR, breakpointAddress));
}
Aggregations