Search in sources :

Example 61 with INaviModule

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

the class PostgreSQLProviderTest method testInstructionFunctionsAddReference6.

@Test(expected = CouldntSaveDataException.class)
public void testInstructionFunctionsAddReference6() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(1);
    module.load();
    final INaviFunction function = module.getContent().getFunctionContainer().getFunctions().get(1800);
    function.load();
    final IBlockNode basicBlock = function.getBasicBlocks().get(0);
    final INaviInstruction instruction = Iterables.get(basicBlock.getInstructions(), 1);
    final COperandTree tree = instruction.getOperands().get(0);
    final INaviOperandTreeNode node = tree.getRootNode();
    final IAddress address = instruction.getAddress();
    final ReferenceType type = ReferenceType.DATA;
    PostgreSQLInstructionFunctions.addReference(getProvider(), node, address, type);
}
Also used : INaviOperandTreeNode(com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) IBlockNode(com.google.security.zynamics.binnavi.disassembly.IBlockNode) COperandTree(com.google.security.zynamics.binnavi.disassembly.COperandTree) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) ReferenceType(com.google.security.zynamics.zylib.disassembly.ReferenceType) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 62 with INaviModule

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

the class PostgreSQLProviderTest method testInstructionFunctionsCreateInstruction1.

@Test
public void testInstructionFunctionsCreateInstruction1() throws SQLException, CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final String mnemonic = "burzel";
    final IAddress iAddress = new CAddress(0x1234);
    final COperandTreeNode rootNode = module.createOperandExpression("eax", ExpressionType.REGISTER);
    final COperandTree tree = new COperandTree(rootNode, getProvider(), module.getTypeManager(), module.getContent().getTypeInstanceContainer());
    final List<COperandTree> operands = new ArrayList<COperandTree>();
    operands.add(tree);
    final byte[] data = { 0xF };
    final String architecture = "x86-32";
    final INaviInstruction instruction = module.createInstruction(iAddress, mnemonic, operands, data, architecture);
    PostgreSQLInstructionFunctions.createInstructions(getProvider(), Lists.newArrayList(instruction));
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) COperandTreeNode(com.google.security.zynamics.binnavi.disassembly.COperandTreeNode) COperandTree(com.google.security.zynamics.binnavi.disassembly.COperandTree) ArrayList(java.util.ArrayList) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 63 with INaviModule

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

the class PostgreSQLProviderTest method testCViewLoaderLoadView5.

@Test(expected = NullPointerException.class)
public void testCViewLoaderLoadView5() throws CouldntLoadDataException, LoadCancelledException, CPartialLoadException {
    final INaviModule module = getProvider().loadModules().get(0);
    final List<INaviModule> modules = new ArrayList<INaviModule>();
    module.load();
    final CView view = (CView) module.getContent().getViewContainer().getViews().get(224);
    modules.add(module);
    PostgreSQLViewLoader.loadView((AbstractSQLProvider) getProvider(), view, modules, null);
}
Also used : CView(com.google.security.zynamics.binnavi.disassembly.views.CView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ArrayList(java.util.ArrayList) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 64 with INaviModule

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

the class PostgreSQLProviderTest method testGetViewsWithAddressFail2.

@Test(expected = NullPointerException.class)
public void testGetViewsWithAddressFail2() throws CouldntLoadDataException {
    final INaviModule module = getProvider().loadModules().get(0);
    getProvider().getViewsWithAddresses(module, null, true);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 65 with INaviModule

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

the class PostgreSQLProviderTest method testCViewFunctionsStarView.

@Test
public void testCViewFunctionsStarView() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException, CouldntSaveDataException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final List<INaviView> views = module.getContent().getViewContainer().getViews();
    final INaviView view = views.get(264);
    view.load();
    PostgreSQLViewFunctions.starView((AbstractSQLProvider) getProvider(), (CView) view, true);
    view.close();
    module.close();
    final INaviModule module2 = getProvider().loadModules().get(0);
    module2.load();
    final List<INaviView> views2 = module2.getContent().getViewContainer().getViews();
    final INaviView view2 = views2.get(264);
    view2.load();
    assertTrue(view2.isStared());
    PostgreSQLViewFunctions.starView((AbstractSQLProvider) getProvider(), (CView) view2, false);
    view2.close();
    module2.close();
    final INaviModule module3 = getProvider().loadModules().get(0);
    module3.load();
    final List<INaviView> views3 = module3.getContent().getViewContainer().getViews();
    final INaviView view3 = views3.get(264);
    view3.load();
    assertFalse(view3.isStared());
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)180 Test (org.junit.Test)105 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)69 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)39 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)39 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)29 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)28 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)28 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)24 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)22 ArrayList (java.util.ArrayList)19 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)18 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)13 BigInteger (java.math.BigInteger)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)12 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)11 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)11 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)9 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)9 COperandTree (com.google.security.zynamics.binnavi.disassembly.COperandTree)9