use of com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace in project binnavi by google.
the class CRelocationNotifier method checkBaseAddresses.
/**
* Tests the correctness of the base addresses of memory modules and displays corrected base
* addresses to the user.
*
* @param parent Parent window used for dialogs.
* @param debugger The active debugger.
* @param viewContainer The view container that is being debugged.
* @param memoryModules The modules whose base addresses are checked.
*/
public static void checkBaseAddresses(final JFrame parent, final IDebugger debugger, final IViewContainer viewContainer, final List<MemoryModule> memoryModules) {
final List<Pair<INaviModule, MemoryModule>> wronglyPlacedModules = collectWronglyPlacedModules(debugger, viewContainer, memoryModules);
if (!wronglyPlacedModules.isEmpty()) {
for (final Pair<INaviModule, MemoryModule> pair : wronglyPlacedModules) {
final INaviModule module = pair.first();
final MemoryModule memoryModule = pair.second();
final List<INaviAddressSpace> addressSpaces = viewContainer.getAddressSpaces();
if (addressSpaces == null) {
try {
module.getConfiguration().setImageBase(memoryModule.getBaseAddress().getAddress());
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
}
} else {
for (final INaviAddressSpace addressSpace : addressSpaces) {
if (addressSpace.getContent().getModules().contains(module)) {
try {
addressSpace.getContent().setImageBase(module, memoryModule.getBaseAddress().getAddress());
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
}
}
}
}
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace in project binnavi by google.
the class CAddressSpacesModel method delete.
@Override
public void delete() {
m_project.removeListener(m_projectListener);
if (m_project.isLoaded()) {
for (final INaviAddressSpace addressSpace : m_project.getContent().getAddressSpaces()) {
addressSpace.removeListener(m_addressSpaceListener);
addressSpace.getConfiguration().removeListener(m_addressSpaceConfigurationListener);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace in project binnavi by google.
the class CProjectNode method createChildren.
/**
* Creates the child nodes of project nodes. One child node is added for each address space found
* in the project.
*/
@Override
protected void createChildren() {
if (m_project.isLoaded()) {
for (final INaviAddressSpace addressSpace : m_project.getContent().getAddressSpaces()) {
add(new CAddressSpaceNode(getProjectTree(), this, m_database, m_project, addressSpace, m_container));
}
add(new CProjectViewsContainerNode(getProjectTree(), m_project, m_container));
add(new CTracesNode(getProjectTree(), m_container));
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace in project binnavi by google.
the class CAddressSpacesModel method setValueAt.
@Override
public void setValueAt(final Object value, final int row, final int col) {
if ((col != NAME_COLUMN) && (col != DESCRIPTION_COLUMN)) {
throw new IllegalStateException("IE01170: Column can not be edited");
}
final INaviAddressSpace addressSpace = getAddressSpaces().get(row);
if (col == NAME_COLUMN) {
try {
addressSpace.getConfiguration().setName((String) value);
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00169: " + "Could not save address space name";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The new name of the address space '%s' could not be saved.", addressSpace.getConfiguration().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The address space keeps its old name." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
} else if (col == DESCRIPTION_COLUMN) {
try {
addressSpace.getConfiguration().setDescription((String) value);
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00170: " + "Could not save address space description";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The new description of the address space '%s' could not be saved.", addressSpace.getConfiguration().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The address space keeps its old description." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace in project binnavi by google.
the class CModulesToAddressSpaceHandler method drop.
@SuppressWarnings("unchecked")
@Override
public void drop(final DefaultMutableTreeNode parentNode, final Object data) {
final CAddressSpaceNode addressSpaceNode = (CAddressSpaceNode) parentNode;
final INaviAddressSpace addressSpace = addressSpaceNode.getObject();
final List<CModule> modules = (List<CModule>) data;
for (final CModule module : modules) {
CAddressSpaceFunctions.addModule(m_parent, addressSpace, module);
}
}
Aggregations