Search in sources :

Example 6 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class PostgreSQLProviderTest method testSetDescription3.

@Test(expected = NullPointerException.class)
public void testSetDescription3() throws CouldntSaveDataException, CouldntLoadDataException {
    final INaviProject project = getProvider().loadProjects().get(0);
    final CAddressSpace addressSpace = getProvider().createAddressSpace(project, "SOME_OTHER_ADDRESS_SPACE");
    getProvider().setDescription(addressSpace, null);
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 7 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class PostgreSQLProviderTestSetup method testCreateAddressSpace.

@Test
public void testCreateAddressSpace() throws CouldntSaveDataException {
    final CAddressSpace addressSpace = getProvider().createAddressSpace(loadProject(), "Test Address Space");
    assertNotNull(addressSpace);
}
Also used : CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 8 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class CProjectContent method createAddressSpace.

/**
 * Creates a new address space with the given name in the project. The new address space is
 * immediately saved to the database.
 *
 * This function is guaranteed to be exception-safe. If an exception is thrown while saving the
 * address space to the database, the project object remains unchanged.
 *
 * @param name The name of the new address space.
 *
 * @return The new address space that was created in the project.
 *
 * @throws CouldntSaveDataException Thrown if the address space couldn't be saved to the database.
 */
public CAddressSpace createAddressSpace(final String name) throws CouldntSaveDataException {
    Preconditions.checkNotNull(name, "IE00240: The value null is illegal for address space names");
    final CAddressSpace space = m_provider.createAddressSpace(m_project, name);
    m_addressSpaces.add(space);
    for (final IProjectListener listener : m_listeners) {
        try {
            listener.addedAddressSpace(m_project, space);
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
        }
    }
    m_project.getConfiguration().updateModificationDate();
    return space;
}
Also used : CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) CPartialLoadException(com.google.security.zynamics.binnavi.Database.Exceptions.CPartialLoadException) CouldntDeleteException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)

Example 9 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class CProjectContentTest method testRemoveTrace.

@Test
public void testRemoveTrace() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException, CouldntDeleteException {
    final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
    @SuppressWarnings("unused") final INaviView view = new MockView(m_provider);
    @SuppressWarnings("unused") final INaviView view2 = projectContent.createView("Name", "description");
    assertNotNull(CViewFilter.getTaggedViews(projectContent.getViews(), new CTag(4, "foo", "bar", TagType.VIEW_TAG, m_provider)));
    final CAddressSpace spaceOne = projectContent.createAddressSpace("Address Space 1");
    spaceOne.load();
    final CAddressSpace spaceTwo = projectContent.createAddressSpace("Address Space 2");
    spaceTwo.load();
    final CAddressSpace spaceThree = projectContent.createAddressSpace("Address Space 3");
    spaceThree.load();
    final CAddressSpace spaceFour = projectContent.createAddressSpace("Address Space 4");
    spaceFour.load();
    m_project.load();
    final TraceList trace = new TraceList(3, "name", "desc", m_provider);
    projectContent.removeTrace(trace);
    try {
        projectContent.removeTrace(null);
        fail();
    } catch (final NullPointerException e) {
    }
    final TraceList trace2 = new TraceList(3, "name", "desc", new MockSqlProvider());
    try {
        projectContent.removeTrace(trace2);
        fail();
    } catch (final Exception e) {
    }
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) CouldntDeleteException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException) Test(org.junit.Test)

Example 10 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class PostgreSQLProviderTest method testCAddressSpaceLoaderLoadAddressSpaces1.

@Test
public void testCAddressSpaceLoaderLoadAddressSpaces1() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final DebuggerTemplateManager debuggerManager = new DebuggerTemplateManager(getProvider());
    final CProject project = getProvider().createProject("PROJECT_234");
    getProvider().createAddressSpace(project, "ADDRESS_SPACE_234");
    final List<INaviModule> modules = getProvider().loadModules();
    final List<INaviModule> convertedModules = new ArrayList<INaviModule>();
    convertedModules.add(modules.get(0));
    final List<CAddressSpace> addressSpaces = PostgreSQLAddressSpaceLoader.loadAddressSpaces((AbstractSQLProvider) getProvider(), project, debuggerManager, convertedModules);
    final CAddressSpace addressSpace = addressSpaces.get(0);
    addressSpace.load();
    addressSpace.getContent().addModule(modules.get(0));
    addressSpace.getContent().setImageBase(modules.get(0), new CAddress(0x1234));
    @SuppressWarnings("unused") final List<CAddressSpace> addressSpaces2 = PostgreSQLAddressSpaceLoader.loadAddressSpaces((AbstractSQLProvider) getProvider(), project, debuggerManager, convertedModules);
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ArrayList(java.util.ArrayList) DebuggerTemplateManager(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplateManager) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)23 Test (org.junit.Test)17 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)9 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)8 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)6 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)6 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)5 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)4 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)4 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)4 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)4 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)4 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)4 CProjectNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode)3 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)3 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)3 MockProject (com.google.security.zynamics.binnavi.disassembly.MockProject)3 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3