Search in sources :

Example 11 with DebuggerTemplate

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

the class FunctionTest method setUp.

@Before
public void setUp() {
    m_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, m_provider), null, Integer.MAX_VALUE, false, m_provider);
    m_internalFunction = new CFunction(internalModule, MockView.getFullView(m_provider, com.google.security.zynamics.zylib.disassembly.ViewType.Native, null), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
    m_internalFunction2 = new CFunction(internalModule, MockView.getFullView(m_provider, com.google.security.zynamics.zylib.disassembly.ViewType.Native, null), new CAddress(0x124), "Mock Function 2", "Mock Function 2", "Mock Description 2", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) CFunction(com.google.security.zynamics.binnavi.disassembly.CFunction) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Before(org.junit.Before)

Example 12 with DebuggerTemplate

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

the class CDebuggersModel method delete.

@Override
public void delete() {
    final DebuggerTemplateManager debuggerManager = m_database.getContent().getDebuggerTemplateManager();
    debuggerManager.removeListener(m_debuggerManagerListener);
    for (final DebuggerTemplate debugger : debuggerManager) {
        debugger.removeListener(m_debuggerListener);
    }
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) DebuggerTemplateManager(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplateManager)

Example 13 with DebuggerTemplate

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

the class CDatabaseFunctions method deleteDebuggers.

/**
   * Deletes a debugger template from the database.
   * 
   * @param parent Parent frame used for dialogs.
   * @param database The database where the debugger template is stored.
   * @param debuggers The debugger templates to be deleted.
   * @param updater Updates the project tree if deletion was successful.
   */
public static void deleteDebuggers(final JFrame parent, final IDatabase database, final DebuggerTemplate[] debuggers, final ITreeUpdater updater) {
    if (CMessageBox.showYesNoQuestion(parent, String.format("Do you really want to delete the following debuggers from the database?\n\n%s", CNameListGenerators.getNameList(debuggers))) == JOptionPane.YES_OPTION) {
        for (final DebuggerTemplate debugger : debuggers) {
            new Thread() {

                @Override
                public void run() {
                    final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, true);
                    operation.getProgressPanel().setMaximum(1);
                    operation.getProgressPanel().setText("Removing debugger" + ": " + debugger.getName());
                    operation.getProgressPanel().next();
                    try {
                        database.getContent().getDebuggerTemplateManager().removeDebugger(debugger);
                        updater.update();
                    } catch (final CouldntDeleteException exception) {
                        CUtilityFunctions.logException(exception);
                        final String message = "E00030: " + "Debugger could not be deleted";
                        final String description = CUtilityFunctions.createDescription(String.format("The debugger '%s' could not be deleted. " + "Try to delete the debugger again. " + "If the problem persists, disconnect from and " + "reconnect to the database, restart BinNavi, " + "or contact the BinNavi support.", debugger.getName()), new String[] { "Database connection problems." }, new String[] { "The debugger still exists." });
                        NaviErrorDialog.show(parent, message, description, exception);
                    } finally {
                        operation.stop();
                    }
                }
            }.start();
        }
    }
}
Also used : CouldntDeleteException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException) CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)

Example 14 with DebuggerTemplate

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

the class CNameListGenerators method getNameList.

/**
   * Generates a name list from the names of the given debuggers.
   * 
   * @param debuggers The debuggers that provide the names.
   * 
   * @return The generated name list.
   */
public static String getNameList(final DebuggerTemplate[] debuggers) {
    int count = 0;
    final StringBuilder list = new StringBuilder();
    for (final DebuggerTemplate debugger : debuggers) {
        list.append("- ");
        list.append(debugger.getName());
        list.append('\n');
        count++;
        if ((count == MAX_LIST_LENGTH) && (debuggers.length != MAX_LIST_LENGTH)) {
            list.append("\n... ");
            list.append(String.format("%d others ...", debuggers.length - count));
            break;
        }
    }
    return list.toString();
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)

Example 15 with DebuggerTemplate

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

the class ViewEdgeTest method setUp.

@Before
public void setUp() throws CouldntLoadDataException, LoadCancelledException {
    final MockSqlProvider provider = new MockSqlProvider();
    final Database database = new Database(new MockDatabase());
    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 TagManager nodeTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.NODE_TAG));
    final TagManager viewTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));
    final Module module = new Module(database, internalModule, nodeTagManager, viewTagManager);
    internalModule.getContent().getViewContainer().createView("", "");
    // new View(module, mockView, nodeTagManager,
    final View view = module.getViews().get(2);
    // viewTagManager);
    final ArrayList<IComment> comment = Lists.<IComment>newArrayList(new CComment(null, CommonTestObjects.TEST_USER_1, null, " COMMENT "));
    m_source = view.createTextNode(comment);
    m_target = view.createTextNode(comment);
    // m_internalEdge = new CNaviEdge(1, internalNode, internalNode,
    // com.google.security.zynamics.zylib.gui.zygraph.edges.EdgeType.JUMP_UNCONDITIONAL, 0, 0, 0, 0,
    // Color.MAGENTA,
    // false, true, "", new FilledList<CBend>(), new MockSqlProvider());
    // new
    m_edge = view.createEdge(m_source, m_target, EdgeType.JumpUnconditional);
// ViewEdge(m_internalEdge,
// m_source,
// m_target);
}
Also used : IComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) MockTagManager(com.google.security.zynamics.binnavi.Tagging.MockTagManager) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) CComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment) MockTagManager(com.google.security.zynamics.binnavi.Tagging.MockTagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) Before(org.junit.Before)

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