Search in sources :

Example 1 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 2 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 3 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 4 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)

Example 5 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)

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