Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/debugadaptertype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ using namespace BinaryNinjaDebuggerAPI;
using namespace std;


DebugAdapterType* DebugAdapterType::GetByName(const std::string& name)
DbgRef<DebugAdapterType> DebugAdapterType::GetByName(const std::string& name)
{
BNDebugAdapterType* adapter = BNGetDebugAdapterTypeByName(name.c_str());
if (!adapter)
Expand Down
2 changes: 1 addition & 1 deletion api/debuggerapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ namespace BinaryNinjaDebuggerAPI {
{
public:
DebugAdapterType(BNDebugAdapterType* adapterType);
static DebugAdapterType* GetByName(const std::string& name);
static DbgRef<DebugAdapterType> GetByName(const std::string& name);
bool CanExecute(Ref<BinaryView> data);
bool CanConnect(Ref<BinaryView> data);
static std::vector<std::string> GetAvailableAdapters(Ref<BinaryView> data);
Expand Down
5 changes: 2 additions & 3 deletions ui/attachprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ bool ProcessListFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIn

void ProcessListWidget::contextMenuEvent(QContextMenuEvent* event)
{
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}


Expand Down Expand Up @@ -319,11 +319,10 @@ ProcessListWidget::ProcessListWidget(QWidget* parent, DbgRef<DebuggerController>

m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
m_menu = new Menu();

QString actionName = QString::fromStdString("Refresh");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST);
m_menu.addAction(actionName, "Options", MENU_ORDER_FIRST);
m_actionHandler.bindAction(actionName, UIAction([this]() { updateContent(); }));

// TODO: context menu copy
Expand Down
2 changes: 1 addition & 1 deletion ui/attachprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ProcessListWidget : public QTableView, public FilterTarget

UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager;
Menu* m_menu;
Menu m_menu;

virtual void contextMenuEvent(QContextMenuEvent* event) override;

Expand Down
4 changes: 2 additions & 2 deletions ui/breakpointswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ limitations under the License.
#include <QMessageBox>
#include <QStyleOptionButton>
#include "breakpointswidget.h"
#include "base/assertions.h"
#include "hardwarebreakpointdialog.h"
#include "ui.h"
#include "menus.h"
Expand Down Expand Up @@ -378,9 +379,8 @@ DebugBreakpointsWidget::DebugBreakpointsWidget(ViewFrame* view, BinaryViewRef da

m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
BN_RELEASE_ASSERT(menu != nullptr);
m_menu = menu;
if (m_menu == nullptr)
m_menu = new Menu();

QString removeBreakpointActionName = QString::fromStdString("Remove Breakpoint");
UIAction::registerAction(removeBreakpointActionName, QKeySequence::Delete);
Expand Down
2 changes: 1 addition & 1 deletion ui/debuggerinfowidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ void DebugInfoSidebarWidget::notifyFontChanged()
}


DebuggerInfoEntryItemDelegate::DebuggerInfoEntryItemDelegate(QWidget* parent): m_render(parent)
DebuggerInfoEntryItemDelegate::DebuggerInfoEntryItemDelegate(QWidget* parent): QStyledItemDelegate(parent), m_render(parent)
{
updateFonts();
}
Expand Down
11 changes: 5 additions & 6 deletions ui/moduleswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,18 @@ DebugModulesWidget::DebugModulesWidget(ViewFrame* view, BinaryViewRef data) : QT

m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
m_menu = new Menu();

QString actionName = QString::fromStdString("Jump To Start");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST);
m_menu.addAction(actionName, "Options", MENU_ORDER_FIRST);
m_actionHandler.bindAction(actionName, UIAction([this]() { jumpToStart(); }));

actionName = QString::fromStdString("Jump To End");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST);
m_menu.addAction(actionName, "Options", MENU_ORDER_FIRST);
m_actionHandler.bindAction(actionName, UIAction([this]() { jumpToEnd(); }));

m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return canCopy(); }));
m_actionHandler.setActionDisplayName("Copy", [&]() {
QModelIndexList sel = selectionModel()->selectedIndexes();
Expand All @@ -333,7 +332,7 @@ DebugModulesWidget::DebugModulesWidget(ViewFrame* view, BinaryViewRef data) : QT
});

UIAction::registerAction("Copy All");
m_menu->addAction("Copy All", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy All", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy All", UIAction([&]() { copyAll(); }, [&]() { return canCopyAll(); }));

connect(this, &QTableView::doubleClicked, this, &DebugModulesWidget::onDoubleClicked);
Expand Down Expand Up @@ -404,7 +403,7 @@ void DebugModulesWidget::contextMenuEvent(QContextMenuEvent* event)

void DebugModulesWidget::showContextMenu()
{
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}


Expand Down
2 changes: 1 addition & 1 deletion ui/moduleswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class DebugModulesWidget : public QTableView, public FilterTarget

UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager;
Menu* m_menu;
Menu m_menu;

virtual void contextMenuEvent(QContextMenuEvent* event) override;

Expand Down
4 changes: 2 additions & 2 deletions ui/registerswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ limitations under the License.
#include "util.h"
#include "clickablelabel.h"
#include "registerswidget.h"
#include "base/assertions.h"

using namespace BinaryNinja;
using namespace std;
Expand Down Expand Up @@ -450,9 +451,8 @@ DebugRegistersWidget::DebugRegistersWidget(ViewFrame* view, BinaryViewRef data,

m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
BN_RELEASE_ASSERT(menu != nullptr);
m_menu = menu;
if (m_menu == nullptr)
m_menu = new Menu();

QString actionName = QString::fromStdString("Set to Zero");
UIAction::registerAction(actionName);
Expand Down
15 changes: 7 additions & 8 deletions ui/threadframes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ QSize ThreadFramesItemDelegate::sizeHint(const QStyleOptionViewItem& option, con

void ThreadFramesWidget::contextMenuEvent(QContextMenuEvent* event)
{
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}

void ThreadFramesWidget::makeItSoloThread()
Expand Down Expand Up @@ -675,27 +675,26 @@ ThreadFramesWidget::ThreadFramesWidget(QWidget* parent, ViewFrame* frame, Binary

m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
m_menu = new Menu();

QString actionName = QString::fromStdString("Suspend Thread");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST);
m_menu.addAction(actionName, "Options", MENU_ORDER_FIRST);
m_actionHandler.bindAction(
actionName, UIAction([this]() { suspendThread(); }, [this]() { return canSuspendOrResume(); }));

actionName = QString::fromStdString("Resume Thread");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST);
m_menu.addAction(actionName, "Options", MENU_ORDER_FIRST);
m_actionHandler.bindAction(
actionName, UIAction([this]() { resumeThread(); }, [this]() { return canSuspendOrResume(); }));

actionName = QString::fromStdString("Make It Solo Thread");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST);
m_menu.addAction(actionName, "Options", MENU_ORDER_FIRST);
m_actionHandler.bindAction(
actionName, UIAction([this]() { makeItSoloThread(); }, [this]() { return canSuspendOrResume(); }));

m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return selectionNotEmpty(); }));
m_actionHandler.setActionDisplayName("Copy", [&]() {
QModelIndexList sel = selectionModel()->selectedIndexes();
Expand Down Expand Up @@ -727,13 +726,13 @@ ThreadFramesWidget::ThreadFramesWidget(QWidget* parent, ViewFrame* frame, Binary

actionName = QString::fromStdString("Copy Current Stack Trace");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_NORMAL);
m_menu.addAction(actionName, "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction(
actionName, UIAction([this]() { copyCurrentFrame(); }, [this]() { return selectionNotEmpty(); }));

actionName = QString::fromStdString("Copy All Stack Traces");
UIAction::registerAction(actionName);
m_menu->addAction(actionName, "Options", MENU_ORDER_NORMAL);
m_menu.addAction(actionName, "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction(actionName, UIAction([this]() { copyAllFrames(); }));

// TODO: set as active thread action?
Expand Down
2 changes: 1 addition & 1 deletion ui/threadframes.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class ThreadFramesWidget : public QTreeView

UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager;
Menu* m_menu;
Menu m_menu;

size_t m_debuggerEventCallback;

Expand Down
19 changes: 9 additions & 10 deletions ui/ttdbookmarkwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,29 +147,28 @@ void TTDBookmarkWidget::setupUIActions()
{
m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
m_menu = new Menu();

m_menu->addAction("Add TTD Bookmark...", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Add TTD Bookmark...", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Add TTD Bookmark...", UIAction([&]() { addBookmarkFromDialog(); }));

m_menu->addAction("Bookmark Current Position", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Bookmark Current Position", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Bookmark Current Position", UIAction([&]() { addBookmarkFromCurrentPosition(); }));

m_menu->addAction("Edit Bookmark...", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Edit Bookmark...", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Edit Bookmark...", UIAction([&]() { editSelectedBookmark(); },
[&]() { return m_resultsTable->selectionModel()->hasSelection(); }));

m_menu->addAction("Remove Bookmark", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Remove Bookmark", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Remove Bookmark", UIAction([&]() { removeSelectedBookmark(); },
[&]() { return m_resultsTable->selectionModel()->hasSelection(); }));

m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return canCopy(); }));

m_menu->addAction("Copy Row", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy Row", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy Row", UIAction([&]() { copySelectedRow(); }, [&]() { return canCopy(); }));

m_menu->addAction("Copy Table", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy Table", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy Table", UIAction([&]() { copyEntireTable(); },
[&]() { return m_resultsTable->rowCount() > 0; }));
}
Expand Down Expand Up @@ -324,13 +323,13 @@ void TTDBookmarkWidget::navigateToPendingViewAddress()
void TTDBookmarkWidget::contextMenuEvent(QContextMenuEvent* event)
{
if (m_contextMenuManager)
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}

void TTDBookmarkWidget::showContextMenu(const QPoint& position)
{
if (m_contextMenuManager)
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}

void TTDBookmarkWidget::addBookmarkFromDialog()
Expand Down
2 changes: 1 addition & 1 deletion ui/ttdbookmarkwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TTDBookmarkWidget : public QWidget

UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager;
Menu* m_menu;
Menu m_menu;

std::vector<TTDBookmark> m_bookmarks;
uint64_t m_pendingViewAddress = 0;
Expand Down
15 changes: 7 additions & 8 deletions ui/ttdcallswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,25 @@ void TTDCallsQueryWidget::setupUIActions()
{
m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
m_menu = new Menu();

// Add Copy action with Ctrl+C support
m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return canCopy(); }));

m_menu->addAction("Copy Row", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy Row", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy Row", UIAction([&]() { copySelectedRow(); }, [&]() { return canCopy(); }));

m_menu->addAction("Copy Table", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy Table", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction(
"Copy Table", UIAction([&]() { copyEntireTable(); }, [&]() { return m_resultsTable->rowCount() > 0; }));

m_menu->addAction("Column Visibility...", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Column Visibility...", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Column Visibility...", UIAction([&]() { showColumnVisibilityDialog(); }));

m_menu->addAction("Reset Columns to Default", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Reset Columns to Default", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Reset Columns to Default", UIAction([&]() { resetColumnsToDefault(); }));

m_menu->addAction("Add TTD Bookmark...", "Bookmark", MENU_ORDER_NORMAL);
m_menu.addAction("Add TTD Bookmark...", "Bookmark", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Add TTD Bookmark...", UIAction([&]() {
int row = m_resultsTable->currentRow();
if (row < 0)
Expand Down Expand Up @@ -551,7 +550,7 @@ void TTDCallsQueryWidget::contextMenuEvent(QContextMenuEvent* event)

void TTDCallsQueryWidget::showContextMenu(const QPoint& position)
{
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}

bool TTDCallsQueryWidget::canCopy()
Expand Down
2 changes: 1 addition & 1 deletion ui/ttdcallswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class TTDCallsQueryWidget : public QWidget
// UIAction support
UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager;
Menu* m_menu;
Menu m_menu;

void setupUI();
void setupTable();
Expand Down
19 changes: 9 additions & 10 deletions ui/ttdeventswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,29 +328,28 @@ void TTDEventsQueryWidget::setupUIActions()
{
m_actionHandler.setupActionHandler(this);
m_contextMenuManager = new ContextMenuManager(this);
m_menu = new Menu();

// Add Copy action with Ctrl+C support
m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return canCopy(); }));

m_menu->addAction("Copy Row", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy Row", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy Row", UIAction([&]() { copySelectedRow(); }, [&]() { return canCopy(); }));

m_menu->addAction("Copy Table", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Copy Table", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Copy Table", UIAction([&]() { copyEntireTable(); }, [&]() { return m_resultsTable->rowCount() > 0; }));

m_menu->addAction("Column Visibility...", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Column Visibility...", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Column Visibility...", UIAction([&]() { showColumnVisibilityDialog(); }));

m_menu->addAction("Reset Columns to Default", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Reset Columns to Default", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Reset Columns to Default", UIAction([&]() { resetColumnsToDefault(); }));

// Refresh action to clear and re-query from backend
m_menu->addAction("Refresh", "Options", MENU_ORDER_NORMAL);
m_menu.addAction("Refresh", "Options", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Refresh", UIAction([&]() { refreshEvents(); }));

m_menu->addAction("Add TTD Bookmark...", "Bookmark", MENU_ORDER_NORMAL);
m_menu.addAction("Add TTD Bookmark...", "Bookmark", MENU_ORDER_NORMAL);
m_actionHandler.bindAction("Add TTD Bookmark...", UIAction([&]() {
int row = m_resultsTable->currentRow();
if (row < 0)
Expand Down Expand Up @@ -850,15 +849,15 @@ void TTDEventsQueryWidget::contextMenuEvent(QContextMenuEvent* event)
{
if (m_contextMenuManager)
{
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}
}

void TTDEventsQueryWidget::showContextMenu(const QPoint& position)
{
if (m_contextMenuManager)
{
m_contextMenuManager->show(m_menu, &m_actionHandler);
m_contextMenuManager->show(&m_menu, &m_actionHandler);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ui/ttdeventswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class TTDEventsQueryWidget : public QWidget
// UIAction support
UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager;
Menu* m_menu;
Menu m_menu;

// All events cache
std::vector<TTDEvent> m_allEvents;
Expand Down
Loading