Search in sources :

Example 16 with DebuggerTemplate

use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.

the class ProjectFactory method get.

public static Project get() {
    final MockSqlProvider provider = new MockSqlProvider();
    final Date creationDate = new Date();
    final Date modificationDate = new Date();
    final CProject internalProject = new CProject(123, "Name", "Comment", creationDate, modificationDate, 55, new FilledList<DebuggerTemplate>(), provider);
    final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
    final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
    final Database db = new Database(new MockDatabase());
    return new Project(db, internalProject, nodeTagManager, viewTagManager);
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) Date(java.util.Date) Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProject(com.google.security.zynamics.binnavi.disassembly.CProject) TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) Tree(com.google.security.zynamics.zylib.types.trees.Tree) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)

Example 17 with DebuggerTemplate

use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.

the class InstructionTest method testConstructor.

@Test
public void testConstructor() throws CouldntLoadDataException, LoadCancelledException {
    final SQLProvider provider = new MockSqlProvider();
    final CModule internalModule = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
    internalModule.load();
    final COperandTreeNode rootNode1 = new COperandTreeNode(1, IOperandTree.NODE_TYPE_REGISTER_ID, "eax", null, new ArrayList<IReference>(), provider, internalModule.getTypeManager(), internalModule.getContent().getTypeInstanceContainer());
    final COperandTreeNode rootNode2 = new COperandTreeNode(1, IOperandTree.NODE_TYPE_REGISTER_ID, "ebx", null, new ArrayList<IReference>(), provider, internalModule.getTypeManager(), internalModule.getContent().getTypeInstanceContainer());
    final COperandTree operand1 = new COperandTree(rootNode1, provider, internalModule.getTypeManager(), internalModule.getContent().getTypeInstanceContainer());
    final COperandTree operand2 = new COperandTree(rootNode2, provider, internalModule.getTypeManager(), internalModule.getContent().getTypeInstanceContainer());
    final List<COperandTree> operands = Lists.newArrayList(operand1, operand2);
    final CInstruction internalInstruction = new CInstruction(false, internalModule, new CAddress(0x123), "mov", operands, new byte[] { 1, 2, 3 }, "x86-32", provider);
    final Instruction instruction = new Instruction(internalInstruction);
    assertEquals(0x123, instruction.getAddress().toLong());
    assertEquals(null, instruction.getComment());
    assertArrayEquals(new byte[] { 1, 2, 3 }, instruction.getData());
    assertEquals("mov", instruction.getMnemonic());
    assertEquals(2, instruction.getOperands().size());
    assertEquals("eax", instruction.getOperands().get(0).getRootNode().getChildren().get(0).getValue());
    assertEquals("ebx", instruction.getOperands().get(1).getRootNode().getChildren().get(0).getValue());
    assertEquals("123  mov eax, ebx", instruction.toString());
    assertEquals("x86-32", instruction.getArchitecture());
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) COperandTreeNode(com.google.security.zynamics.binnavi.disassembly.COperandTreeNode) CInstruction(com.google.security.zynamics.binnavi.disassembly.CInstruction) CInstruction(com.google.security.zynamics.binnavi.disassembly.CInstruction) SQLProvider(com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) COperandTree(com.google.security.zynamics.binnavi.disassembly.COperandTree) IReference(com.google.security.zynamics.zylib.disassembly.IReference) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Test(org.junit.Test)

Example 18 with DebuggerTemplate

use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.

the class PostgreSQLProviderTestTeardown method testDeleteDebugger2.

@Test
public void testDeleteDebugger2() throws CouldntDeleteException, CouldntLoadDataException {
    final DebuggerTemplate debuggerTemplate = getProvider().loadDebuggers().getDebugger(0);
    getProvider().deleteDebugger(debuggerTemplate);
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 19 with DebuggerTemplate

use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.

the class PostgreSQLProviderTest method testSetNameDebugge3.

@Test(expected = NullPointerException.class)
public void testSetNameDebugge3() throws CouldntSaveDataException, CouldntLoadDataException {
    final DebuggerTemplate debuggerTemplate = getProvider().loadDebuggers().getDebugger(0);
    getProvider().setName(debuggerTemplate, null);
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 20 with DebuggerTemplate

use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.

the class CDebuggerChooserPanel method updateDebuggerLabel.

/**
   * Updates the debugger label in case the module is local to an address space.
   */
private void updateDebuggerLabel() {
    final DebuggerTemplate debugger = m_addressSpace.getConfiguration().getDebuggerTemplate();
    m_debuggerName.setText(debugger == null ? "-" : debugger.getName());
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)

Aggregations

DebuggerTemplate (com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)55 Test (org.junit.Test)29 Date (java.util.Date)20 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)16 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)16 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)12 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)11 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)11 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)8 ArrayList (java.util.ArrayList)8 Before (org.junit.Before)8 ResultSet (java.sql.ResultSet)7 SQLException (java.sql.SQLException)6 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)5 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)5 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)5 CInstruction (com.google.security.zynamics.binnavi.disassembly.CInstruction)5 SQLProvider (com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider)4 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)4 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)4