use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class BreakpointManager method setEchoBreakpoint.
// ! Sets an echo breakpoint.
/**
* Sets an echo 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 setEchoBreakpoint(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.ECHO, breakpoints);
return echoBreakpointMap.get(breakpointManager.getBreakpoint(BreakpointType.ECHO, breakpointAddress));
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class CDatabaseContent method refreshRawModules.
@Override
public void refreshRawModules() throws CouldntLoadDataException {
Preconditions.checkArgument(m_database.isConnected(), "IE00687: Not connected to the database");
Preconditions.checkArgument(m_database.isLoaded(), "IE00688: Raw modules were not loaded previously");
final List<INaviRawModule> oldModules = m_rawModules;
final List<INaviRawModule> refreshedModules = m_provider.loadRawModules();
m_rawModules.clear();
m_rawModules.addAll(refreshedModules);
final List<INaviModule> newModules = initializeRawModules(m_modules, refreshedModules);
for (final IDatabaseListener listener : m_listeners) {
try {
listener.changedRawModules(m_database, oldModules, refreshedModules);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
for (final INaviModule naviModule : newModules) {
for (final IDatabaseListener listener : m_listeners) {
try {
listener.addedModule(m_database, naviModule);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class CCodeNodeParser method createLine.
/**
* Creates raw instruction data from a code node provider.
*
* @param instructionSet Provides the raw data.
*
* @return The generated raw data object.
*
* @throws ParserException Thrown if not all instruction data could be read.
*/
private InstructionLine createLine(final ICodeNodeProvider instructionSet) throws ParserException {
final InstructionLine row = new InstructionLine();
row.setBasicBlock(instructionSet.getNodeId());
row.setAddress(instructionSet.getInstructionAddress());
row.setMnemonic(instructionSet.getMnemonic());
row.setArchitecture(instructionSet.getInstructionArchitecture());
final int moduleId = instructionSet.getModule();
final IAddress parentFunction = instructionSet.getParentFunction();
final INaviModule module = modules.get(moduleId);
if (module == null) {
throw new ParserException(String.format("Instruction with ID %d has unknown module with ID %d", row.getId(), moduleId));
}
final INaviFunction function = parentFunction == null ? null : module.getContent().getFunctionContainer().getFunction(parentFunction);
row.setParentFunction(function);
if ((parentFunction != null) && (function == null)) {
throw new ParserException(String.format("Instruction with ID %d has unknown parent function with address %s", row.getId(), parentFunction.toHexString()));
}
row.setX(instructionSet.getX());
row.setY(instructionSet.getY());
row.setColor(new Color(instructionSet.getColor()));
row.setBorderColor(new Color(instructionSet.getBorderColor()));
row.setSelected(instructionSet.isSelected());
row.setVisible(instructionSet.isVisible());
row.setLocalNodeCommentId(instructionSet.getLocalNodeCommentId());
row.setGlobalNodeComment(instructionSet.getGlobalNodeCommentId());
row.setGlobalInstructionComment(instructionSet.getGlobalInstructionCommentId());
row.setLocalInstructionComment(instructionSet.getLocalInstructionCommentId());
row.setData(instructionSet.getData());
row.setModule(module);
return row;
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class CCodeNodeParser method createCurrentNode.
/**
* Creates a new code node.
*
* @param resultSet Provides the data for the code node.
*
* @return The created code node object.
*
* @throws ParserException Thrown if the node data could not be read.
* @throws CPartialLoadException Thrown if not all required modules are loaded.
*/
private CCodeNode createCurrentNode(final ICodeNodeProvider resultSet) throws ParserException, CPartialLoadException {
final int nodeId = resultSet.getNodeId();
final int moduleId = resultSet.getModule();
final IAddress parentFunction = resultSet.getParentFunction();
final INaviModule module = modules.get(moduleId);
if (module == null) {
throw new ParserException(String.format("Node with ID %d has unknown parent module with ID %d", nodeId, moduleId));
}
if (!module.isLoaded()) {
try {
module.load();
} catch (final CouldntLoadDataException e) {
throw new CPartialLoadException("E00066: The view could not be loaded because not all modules that form the view could be loaded", module);
} catch (final LoadCancelledException e) {
throw new CPartialLoadException("E00067: The view could not be loaded because it was cancelled", module);
}
}
final INaviFunction function = parentFunction == null ? null : module.getContent().getFunctionContainer().getFunction(parentFunction);
if ((parentFunction != null) && (function == null)) {
throw new ParserException(String.format("Node with ID %d has unknown parent function with address %s", nodeId, parentFunction.toHexString()));
}
final double x = resultSet.getX();
final double y = resultSet.getY();
final double width = resultSet.getWidth();
final double height = resultSet.getHeight();
final Color color = new Color(resultSet.getColor());
final Color bordercolor = new Color(resultSet.getBorderColor());
final boolean selected = resultSet.isSelected();
final boolean visible = resultSet.isVisible();
final Integer localCodeNodeCommentId = resultSet.getLocalNodeCommentId();
final Integer globalCodeNodeCommentId = resultSet.getGlobalNodeCommentId();
// TODO(timkornau): final new Set<CTag>! must replaced by a set which
// contains the loaded node
// tags from the DB
final CCodeNode codeNode = new CCodeNode(nodeId, x, y, width, height, color, bordercolor, selected, visible, null, function, new HashSet<CTag>(), sqlProvider);
if (localCodeNodeCommentId != null) {
localCommentIdToCodeNode.put(localCodeNodeCommentId, codeNode);
}
if (globalCodeNodeCommentId != null) {
globalCommentIdToCodeNode.put(globalCodeNodeCommentId, codeNode);
}
return codeNode;
}
use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.
the class Database method convertData.
/**
* Converts the native objects stored in the database to API objects.
*/
private void convertData() {
m_viewTagManager = new TagManager(m_database.getContent().getViewTagManager());
m_nodeTagManager = new TagManager(m_database.getContent().getNodeTagManager());
m_modules.clear();
m_projects.clear();
for (final INaviModule module : m_database.getContent().getModules()) {
m_modules.add(new Module(this, module, m_nodeTagManager, m_viewTagManager));
}
for (final INaviProject project : m_database.getContent().getProjects()) {
m_projects.add(new Project(this, project, m_nodeTagManager, m_viewTagManager));
}
m_debuggerTemplateManager = new DebuggerTemplateManager(m_database.getContent().getDebuggerTemplateManager());
}
Aggregations