Search in sources :

Example 6 with INaviAddressSpace

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);
                        }
                    }
                }
            }
        }
    }
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) Pair(com.google.security.zynamics.zylib.general.Pair) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 7 with INaviAddressSpace

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);
        }
    }
}
Also used : INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 8 with INaviAddressSpace

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));
    }
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) CTracesNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Traces.CTracesNode) CProjectViewsContainerNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Project.CProjectViewsContainerNode) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 9 with INaviAddressSpace

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);
        }
    }
}
Also used : CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 10 with INaviAddressSpace

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);
    }
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) List(java.util.List) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Aggregations

INaviAddressSpace (com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)11 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)2 CAddressSpaceNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode)2 CDefaultProgressOperation (com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation)2 AddressSpace (com.google.security.zynamics.binnavi.API.disassembly.AddressSpace)1 Database (com.google.security.zynamics.binnavi.API.disassembly.Database)1 DatabaseManager (com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager)1 Project (com.google.security.zynamics.binnavi.API.disassembly.Project)1 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)1 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)1 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)1 IDatabase (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase)1 CLoadAddressSpaceAction (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CLoadAddressSpaceAction)1 CTracesNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Traces.CTracesNode)1 CProjectViewsContainerNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Project.CProjectViewsContainerNode)1 MemoryModule (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule)1 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)1 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)1 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)1 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)1