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
12 changes: 8 additions & 4 deletions include/IPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@
public:
virtual QMenu *menu(QWidget *parent = nullptr) = 0;

public:
// optional, overload this to provide actions that are available by global shortcuts
virtual QList<QAction *> globalShortcuts() { return {}; }

public:
// optional, overload these to have there contents added to a view's context menu
virtual QList<QAction *> cpuContextMenu() { return {}; }
virtual QList<QAction *> registerContextMenu() { return {}; }
virtual QList<QAction *> stackContextMenu() { return {}; }
virtual QList<QAction *> dataContextMenu() { return {}; }
virtual QList<QAction *> cpuContextMenu(QMenu */*parent*/) { return {}; }
virtual QList<QAction *> registerContextMenu(QMenu */*parent*/) { return {}; }
virtual QList<QAction *> stackContextMenu(QMenu */*parent*/) { return {}; }
virtual QList<QAction *> dataContextMenu(QMenu */*parent*/) { return {}; }

// optional, overload this to add a page to the options dialog
virtual QWidget *optionsPage() { return nullptr; }

public:

Check warning on line 59 in include/IPlugin.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this redundant access specifier; it does not change the accessibility level.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brgwAYReTk2gkJWt&open=AZz_brgwAYReTk2gkJWt&pullRequest=750
virtual QVariantMap saveState() const { return {}; }
virtual void restoreState(const QVariantMap &) {}

Expand Down
12 changes: 6 additions & 6 deletions plugins/Analyzer/Analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@
Q_ASSERT(results);

// give bonus if we have a symbol for the address
std::for_each(results->begin(), results->end(), [](Function &function) {
if (is_thunk(function.entryAddress())) {
function.setType(Function::Thunk);
} else {
function.setType(Function::Standard);
}
});

Check warning on line 126 in plugins/Analyzer/Analyzer.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace with the version of "std::ranges::for_each" that takes a range.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brcoAYReTk2gkJWc&open=AZz_brcoAYReTk2gkJWc&pullRequest=750
}

/**
Expand Down Expand Up @@ -316,15 +316,15 @@
* @brief Analyzer::cpuContextMenu
* @return
*/
QList<QAction *> Analyzer::cpuContextMenu() {
QList<QAction *> Analyzer::cpuContextMenu(QMenu *parent) {

QList<QAction *> ret;

auto action_find = new QAction(tr("Analyze Here"), this);
auto action_goto_function_start = new QAction(tr("Goto Function Start"), this);
auto action_goto_function_end = new QAction(tr("Goto Function End"), this);
auto action_mark_function_start = new QAction(tr("Mark As Function Start"), this);
auto action_xrefs = new QAction(tr("Show X-Refs"), this);
auto action_find = new QAction(tr("Analyze Here"), parent);

Check failure on line 323 in plugins/Analyzer/Analyzer.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brcoAYReTk2gkJWd&open=AZz_brcoAYReTk2gkJWd&pullRequest=750
auto action_goto_function_start = new QAction(tr("Goto Function Start"), parent);

Check failure on line 324 in plugins/Analyzer/Analyzer.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brcoAYReTk2gkJWe&open=AZz_brcoAYReTk2gkJWe&pullRequest=750
auto action_goto_function_end = new QAction(tr("Goto Function End"), parent);

Check failure on line 325 in plugins/Analyzer/Analyzer.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brcoAYReTk2gkJWf&open=AZz_brcoAYReTk2gkJWf&pullRequest=750
auto action_mark_function_start = new QAction(tr("Mark As Function Start"), parent);

Check failure on line 326 in plugins/Analyzer/Analyzer.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brcoAYReTk2gkJWg&open=AZz_brcoAYReTk2gkJWg&pullRequest=750
auto action_xrefs = new QAction(tr("Show X-Refs"), parent);

Check failure on line 327 in plugins/Analyzer/Analyzer.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brcoAYReTk2gkJWh&open=AZz_brcoAYReTk2gkJWh&pullRequest=750

connect(action_find, &QAction::triggered, this, &Analyzer::doViewAnalysis);
connect(action_goto_function_start, &QAction::triggered, this, &Analyzer::gotoFunctionStart);
Expand Down
2 changes: 1 addition & 1 deletion plugins/Analyzer/Analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Analyzer final : public QObject, public IAnalyzer, public IPlugin {

public:
QMenu *menu(QWidget *parent = nullptr) override;
QList<QAction *> cpuContextMenu() override;
QList<QAction *> cpuContextMenu(QMenu *parent) override;

private:
void privateInit() override;
Expand Down
24 changes: 16 additions & 8 deletions plugins/Assembler/Assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ namespace AssemblerPlugin {
* @param parent
*/
Assembler::Assembler(QObject *parent)
: QObject(parent) {
: QObject(parent),
action_assemble_(tr("&Assemble..."), this) {
action_assemble_.setShortcut(QKeySequence(tr("Space")));
connect(&action_assemble_, &QAction::triggered, this, &Assembler::showDialog);
}

/**
Expand All @@ -44,19 +47,24 @@ Assembler::~Assembler() {
}

/**
* @brief Assembler::cpuContextMenu
* @brief Assembler::globalShortcuts
* @return
*/
QList<QAction *> Assembler::cpuContextMenu() {
QList<QAction *> Assembler::globalShortcuts() {

QList<QAction *> ret;
ret << &action_assemble_;
return ret;
}

auto action_assemble = new QAction(tr("&Assemble..."), this);
action_assemble->setShortcut(QKeySequence(tr("Space")));

connect(action_assemble, &QAction::triggered, this, &Assembler::showDialog);
ret << action_assemble;
/**
* @brief Assembler::cpuContextMenu
* @return
*/
QList<QAction *> Assembler::cpuContextMenu(QMenu *parent) {

QList<QAction *> ret;
ret << &action_assemble_;
return ret;
}

Expand Down
5 changes: 4 additions & 1 deletion plugins/Assembler/Assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ASSEMBLER_H_20130611_

#include "IPlugin.h"
#include <QAction>

class QMenu;
class QDialog;
Expand All @@ -39,14 +40,16 @@ class Assembler : public QObject, public IPlugin {

public:
QMenu *menu(QWidget *parent = nullptr) override;
QList<QAction *> cpuContextMenu() override;
QList<QAction *> globalShortcuts() override;
QList<QAction *> cpuContextMenu(QMenu *parent) override;
QWidget *optionsPage() override;

private:
void showDialog();

private:
QPointer<QDialog> dialog_ = nullptr;
QAction action_assemble_;
};

}
Expand Down
4 changes: 2 additions & 2 deletions plugins/BinarySearcher/BinarySearcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
* @brief BinarySearcher::stackContextMenu
* @return
*/
QList<QAction *> BinarySearcher::stackContextMenu() {
QList<QAction *> BinarySearcher::stackContextMenu(QMenu *parent) {

QList<QAction *> ret;

auto action_find = new QAction(tr("&Find ASCII String"), this);
auto action_find = new QAction(tr("&Find ASCII String"), parent);

Check failure on line 60 in plugins/BinarySearcher/BinarySearcher.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_braoAYReTk2gkJWb&open=AZz_braoAYReTk2gkJWb&pullRequest=750
connect(action_find, &QAction::triggered, this, &BinarySearcher::mnuStackFindAscii);
ret << action_find;

Expand Down
2 changes: 1 addition & 1 deletion plugins/BinarySearcher/BinarySearcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BinarySearcher : public QObject, public IPlugin {

public:
QMenu *menu(QWidget *parent = nullptr) override;
QList<QAction *> stackContextMenu() override;
QList<QAction *> stackContextMenu(QMenu *parent) override;

public Q_SLOTS:
void showMenu();
Expand Down
4 changes: 2 additions & 2 deletions plugins/Bookmarks/Bookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@
* @brief Bookmarks::cpuContextMenu
* @return
*/
QList<QAction *> Bookmarks::cpuContextMenu() {
QList<QAction *> Bookmarks::cpuContextMenu(QMenu *parent) {

QList<QAction *> ret;

auto action_bookmark = new QAction(tr("Add &Bookmark"), this);
auto action_bookmark = new QAction(tr("Add &Bookmark"), parent);

Check failure on line 102 in plugins/Bookmarks/Bookmarks.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_breuAYReTk2gkJWn&open=AZz_breuAYReTk2gkJWn&pullRequest=750
connect(action_bookmark, &QAction::triggered, this, &Bookmarks::addBookmarkMenu);
ret << action_bookmark;

Expand Down
2 changes: 1 addition & 1 deletion plugins/Bookmarks/Bookmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Bookmarks : public QObject, public IPlugin {

public:
QMenu *menu(QWidget *parent = nullptr) override;
QList<QAction *> cpuContextMenu() override;
QList<QAction *> cpuContextMenu(QMenu *parent) override;

public:
QVariantMap saveState() const override;
Expand Down
18 changes: 9 additions & 9 deletions plugins/HardwareBreakpoints/HardwareBreakpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@
* @brief HardwareBreakpoints::stackContextMenu
* @return
*/
QList<QAction *> HardwareBreakpoints::stackContextMenu() {
auto menu = new QMenu(tr("Hardware Breakpoints"));
QList<QAction *> HardwareBreakpoints::stackContextMenu(QMenu *parent) {
auto menu = new QMenu(tr("Hardware Breakpoints"), parent);

Check failure on line 253 in plugins/HardwareBreakpoints/HardwareBreakpoints.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brfaAYReTk2gkJWo&open=AZz_brfaAYReTk2gkJWo&pullRequest=750

auto rw1 = menu->addAction(tr("Hardware, On Read/Write #1"), this, SLOT(setAccess1()));
auto rw2 = menu->addAction(tr("Hardware, On Read/Write #2"), this, SLOT(setAccess2()));
Expand All @@ -274,7 +274,7 @@

QList<QAction *> ret;

auto action = new QAction(tr("Hardware Breakpoints"), this);
auto action = new QAction(tr("Hardware Breakpoints"), parent);
action->setMenu(menu);
ret << action;
return ret;
Expand All @@ -284,8 +284,8 @@
* @brief HardwareBreakpoints::dataContextMenu
* @return
*/
QList<QAction *> HardwareBreakpoints::dataContextMenu() {
auto menu = new QMenu(tr("Hardware Breakpoints"));
QList<QAction *> HardwareBreakpoints::dataContextMenu(QMenu *parent) {
auto menu = new QMenu(tr("Hardware Breakpoints"), parent);

Check failure on line 288 in plugins/HardwareBreakpoints/HardwareBreakpoints.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brfaAYReTk2gkJWp&open=AZz_brfaAYReTk2gkJWp&pullRequest=750

auto rw1 = menu->addAction(tr("Hardware, On Read/Write #1"), this, SLOT(setAccess1()));
auto rw2 = menu->addAction(tr("Hardware, On Read/Write #2"), this, SLOT(setAccess2()));
Expand All @@ -309,7 +309,7 @@

QList<QAction *> ret;

auto action = new QAction(tr("Hardware Breakpoints"), this);
auto action = new QAction(tr("Hardware Breakpoints"), parent);

Check failure on line 312 in plugins/HardwareBreakpoints/HardwareBreakpoints.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brfaAYReTk2gkJWq&open=AZz_brfaAYReTk2gkJWq&pullRequest=750
action->setMenu(menu);
ret << action;
return ret;
Expand All @@ -319,9 +319,9 @@
* @brief HardwareBreakpoints::cpuContextMenu
* @return
*/
QList<QAction *> HardwareBreakpoints::cpuContextMenu() {
QList<QAction *> HardwareBreakpoints::cpuContextMenu(QMenu *parent) {

auto menu = new QMenu(tr("Hardware Breakpoints"));
auto menu = new QMenu(tr("Hardware Breakpoints"), parent);

Check failure on line 324 in plugins/HardwareBreakpoints/HardwareBreakpoints.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brfaAYReTk2gkJWr&open=AZz_brfaAYReTk2gkJWr&pullRequest=750
auto ex1 = menu->addAction(tr("Hardware, On Execute #1"), this, SLOT(setExec1()));
auto ex2 = menu->addAction(tr("Hardware, On Execute #2"), this, SLOT(setExec2()));
auto ex3 = menu->addAction(tr("Hardware, On Execute #3"), this, SLOT(setExec3()));
Expand Down Expand Up @@ -354,7 +354,7 @@

QList<QAction *> ret;

auto action = new QAction(tr("Hardware Breakpoints"), this);
auto action = new QAction(tr("Hardware Breakpoints"), parent);

Check failure on line 357 in plugins/HardwareBreakpoints/HardwareBreakpoints.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brfaAYReTk2gkJWs&open=AZz_brfaAYReTk2gkJWs&pullRequest=750
action->setMenu(menu);
ret << action;
return ret;
Expand Down
6 changes: 3 additions & 3 deletions plugins/HardwareBreakpoints/HardwareBreakpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class HardwareBreakpoints : public QObject, public IPlugin, public IDebugEventHa
public:
QMenu *menu(QWidget *parent = nullptr) override;
edb::EventStatus handleEvent(const std::shared_ptr<IDebugEvent> &event) override;
QList<QAction *> cpuContextMenu() override;
QList<QAction *> stackContextMenu() override;
QList<QAction *> dataContextMenu() override;
QList<QAction *> cpuContextMenu(QMenu *parent) override;
QList<QAction *> stackContextMenu(QMenu *parent) override;
QList<QAction *> dataContextMenu(QMenu *parent) override;

public Q_SLOTS:
void showMenu();
Expand Down
2 changes: 1 addition & 1 deletion plugins/InstructionInspector/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ QMenu *Plugin::menu(QWidget *) {
* @brief Plugin::cpuContextMenu
* @return
*/
QList<QAction *> Plugin::cpuContextMenu() {
QList<QAction *> Plugin::cpuContextMenu(QMenu *) {
return {menuAction_};
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/InstructionInspector/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Plugin : public QObject, public IPlugin {
public:
explicit Plugin(QObject *parent = nullptr);
QMenu *menu(QWidget *parent = nullptr) override;
QList<QAction *> cpuContextMenu() override;
QList<QAction *> cpuContextMenu(QMenu *parent) override;

private:
void showDialog() const;
Expand Down
2 changes: 1 addition & 1 deletion plugins/ODbgRegisterView/RegisterView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
const auto name = regNamePrefix + QString("%1").arg(row);
if (!valid_variant(nameIndex.data()).toString().toUpper().startsWith(regNamePrefix)) {
if (row == 0)
return nullptr; // don't want empty groups

Check failure on line 114 in plugins/ODbgRegisterView/RegisterView.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Potential leak of memory pointed to by 'group'

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brdWAYReTk2gkJWm&open=AZz_brdWAYReTk2gkJWm&pullRequest=750
break;
}

Expand Down Expand Up @@ -170,7 +170,7 @@

if (model_->activeIndex().isValid()) {
QList<QAction *> debuggerActions;
QMetaObject::invokeMethod(edb::v1::debugger_ui, "currentRegisterContextMenuItems", Qt::DirectConnection, Q_RETURN_ARG(QList<QAction *>, debuggerActions));
QMetaObject::invokeMethod(edb::v1::debugger_ui, "currentRegisterContextMenuItems", Qt::DirectConnection, Q_RETURN_ARG(QList<QAction *>, debuggerActions), Q_ARG(QMenu *, &menu));
items.push_back(nullptr);
items.append(debuggerActions);
}
Expand Down Expand Up @@ -331,7 +331,7 @@

auto &types(visibleGroupTypes_);
const int groupType = groupPtrIter - groups_.begin();
types.erase(remove_if(types.begin(), types.end(), [=](int type) { return type == groupType; }), types.end());

Check warning on line 334 in plugins/ODbgRegisterView/RegisterView.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this erase-remove idiom with a "std::erase_if" call.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brdWAYReTk2gkJWi&open=AZz_brdWAYReTk2gkJWi&pullRequest=750

Check warning on line 334 in plugins/ODbgRegisterView/RegisterView.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace with the version of "std::ranges::remove_if" that takes a range.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brdWAYReTk2gkJWj&open=AZz_brdWAYReTk2gkJWj&pullRequest=750
}

void ODBRegView::saveState(const QString &settingsGroup) const {
Expand Down Expand Up @@ -455,10 +455,10 @@

// layout contains not only groups, so delete all items too
while (const auto item = layout->takeAt(0)) {
delete item;

Check failure on line 458 in plugins/ODbgRegisterView/RegisterView.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rewrite the code so that you no longer need this "delete".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brdWAYReTk2gkJWk&open=AZz_brdWAYReTk2gkJWk&pullRequest=750
}

const auto flagsAndSegments = new QHBoxLayout(this);

Check failure on line 461 in plugins/ODbgRegisterView/RegisterView.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brdWAYReTk2gkJWl&open=AZz_brdWAYReTk2gkJWl&pullRequest=750

// (3/2+1/2)-letter — Total of 2-letter spacing. Fourth half-letter is from flag values extension.
// Segment extensions at LHS of the widget don't influence minimumSize request, so no need to take
Expand Down
16 changes: 6 additions & 10 deletions src/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@
if (qobject_cast<QDisassemblyView *>(widget)) {
mnuCPUFollow();
} else {
QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);

Check warning on line 391 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWM&open=AZz_brZcAYReTk2gkJWM&pullRequest=750
QCoreApplication::postEvent(widget, event);
}
});
Expand Down Expand Up @@ -761,9 +761,9 @@
QSettings settings;
settings.beginGroup("Theme");

QColor addressForegroundColor = QColor(settings.value("theme.address.foreground", "red").toString());

Check warning on line 764 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWN&open=AZz_brZcAYReTk2gkJWN&pullRequest=750
QColor alternatingByteColor = QColor(settings.value("theme.alternating_byte.foreground", "blue").toString());

Check warning on line 765 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWO&open=AZz_brZcAYReTk2gkJWO&pullRequest=750
QColor nonPrintableTextColor = QColor(settings.value("theme.non_printing_character.foreground", "red").toString());

Check warning on line 766 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWP&open=AZz_brZcAYReTk2gkJWP&pullRequest=750
hexview->setAddressColor(addressForegroundColor);
hexview->setAlternateWordColor(alternatingByteColor);
hexview->setNonPrintableTextColor(nonPrintableTextColor);
Expand Down Expand Up @@ -858,11 +858,7 @@
}

// setup the shortcuts for these actions
const QList<QAction *> register_actions = p->registerContextMenu();
const QList<QAction *> cpu_actions = p->cpuContextMenu();
const QList<QAction *> stack_actions = p->stackContextMenu();
const QList<QAction *> data_actions = p->dataContextMenu();
const QList<QAction *> actions = register_actions + cpu_actions + stack_actions + data_actions;
const QList<QAction *> actions = p->globalShortcuts();

for (QAction *action : actions) {
QKeySequence shortcut = action->shortcut();
Expand Down Expand Up @@ -978,9 +974,9 @@
QSettings settings;
settings.beginGroup("Theme");

QColor addressForegroundColor = QColor(settings.value("theme.address.foreground", "red").toString());

Check warning on line 977 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWQ&open=AZz_brZcAYReTk2gkJWQ&pullRequest=750
QColor alternatingByteColor = QColor(settings.value("theme.alternating_byte.foreground", "blue").toString());

Check warning on line 978 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWR&open=AZz_brZcAYReTk2gkJWR&pullRequest=750
QColor nonPrintableTextColor = QColor(settings.value("theme.non_printing_character.foreground", "red").toString());

Check warning on line 979 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the redundant type with "auto".

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWS&open=AZz_brZcAYReTk2gkJWS&pullRequest=750
stackView_->setAddressColor(addressForegroundColor);
stackView_->setAlternateWordColor(alternatingByteColor);
stackView_->setNonPrintableTextColor(nonPrintableTextColor);
Expand Down Expand Up @@ -1182,8 +1178,8 @@
*/
void Debugger::setupTabButtons() {
// add the corner widgets to the data view
tabCreate_ = new QToolButton(ui.tabWidget);

Check failure on line 1181 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWT&open=AZz_brZcAYReTk2gkJWT&pullRequest=750
tabDelete_ = new QToolButton(ui.tabWidget);

Check failure on line 1182 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace the use of "new" with an operation that automatically manages the memory.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWU&open=AZz_brZcAYReTk2gkJWU&pullRequest=750

tabCreate_->setToolButtonStyle(Qt::ToolButtonIconOnly);
tabDelete_->setToolButtonStyle(Qt::ToolButtonIconOnly);
Expand Down Expand Up @@ -1231,7 +1227,7 @@
// Name: on_registerList_customContextMenuRequested
// Desc: context menu handler for register view
//------------------------------------------------------------------------------
QList<QAction *> Debugger::currentRegisterContextMenuItems() const {
QList<QAction *> Debugger::currentRegisterContextMenuItems(QMenu *parent) const {
QList<QAction *> allActions;
const auto reg = activeRegister();
if (reg.type() & (Register::TYPE_GPR | Register::TYPE_IP)) {
Expand All @@ -1243,7 +1239,7 @@

allActions.append(actions);
}
allActions.append(getPluginContextMenuItems(&IPlugin::registerContextMenu));
allActions.append(getPluginContextMenuItems(parent, &IPlugin::registerContextMenu));
return allActions;
}

Expand Down Expand Up @@ -1682,7 +1678,7 @@
// Name: on_cpuView_customContextMenuRequested
// Desc:
//------------------------------------------------------------------------------
void Debugger::on_cpuView_customContextMenuRequested(const QPoint &pos) {

Check failure on line 1681 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 28 to the 25 allowed.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWV&open=AZz_brZcAYReTk2gkJWV&pullRequest=750
QMenu menu;

auto displayMenu = new QMenu(tr("Display"), &menu);
Expand Down Expand Up @@ -2215,7 +2211,7 @@
if (bp->internal() && bp->tag == ld_loader_tag) {

if (dynamicInfoBreakpointSet_) {
if (debugtPointer_) {

Check warning on line 2214 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this "if" statement with the enclosing one.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWX&open=AZz_brZcAYReTk2gkJWX&pullRequest=750

Check failure on line 2214 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest more than 3 if|for|do|while|switch statements.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWW&open=AZz_brZcAYReTk2gkJWW&pullRequest=750
if (edb::v1::debuggeeIs32Bit()) {
handle_library_event<uint32_t>(process, debugtPointer_);
} else {
Expand Down Expand Up @@ -2972,7 +2968,7 @@
commonOpen(s, args);
}
} else {
const auto file = recentFileManager_->mostRecent();

Check warning on line 2971 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace this declaration by a structured binding declaration.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWY&open=AZz_brZcAYReTk2gkJWY&pullRequest=750
if (commonOpen(file.first, file.second))
argumentsDialog_->setArguments(file.second);
}
Expand Down Expand Up @@ -3216,12 +3212,12 @@
// NULL pointer items mean "create separator here".
//------------------------------------------------------------------------------
template <class F>
QList<QAction *> Debugger::getPluginContextMenuItems(const F &f) const {
QList<QAction *> Debugger::getPluginContextMenuItems(QMenu *parent, const F &f) const {
QList<QAction *> actions;

for (QObject *plugin : edb::v1::plugin_list()) {
if (auto p = qobject_cast<IPlugin *>(plugin)) {
const QList<QAction *> acts = (p->*f)();
const QList<QAction *> acts = (p->*f)(parent);
if (!acts.isEmpty()) {
actions.push_back(nullptr);
actions.append(acts);
Expand All @@ -3239,7 +3235,7 @@
void Debugger::addPluginContextMenu(const T &menu, const F &f) {
for (QObject *plugin : edb::v1::plugin_list()) {
if (auto p = qobject_cast<IPlugin *>(plugin)) {
const QList<QAction *> acts = (p->*f)();
const QList<QAction *> acts = (p->*f)(menu);
if (!acts.isEmpty()) {
menu->addSeparator();
menu->addActions(acts);
Expand Down Expand Up @@ -3414,8 +3410,8 @@
#if defined(Q_OS_LINUX)
if (!dynamicInfoBreakpointSet_) {
if (IProcess *process = edb::v1::debugger_core->process()) {
if (debugtPointer_ == 0) {

Check failure on line 3413 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest more than 3 if|for|do|while|switch statements.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWZ&open=AZz_brZcAYReTk2gkJWZ&pullRequest=750
if ((debugtPointer_ = process->debugPointer()) != 0) {

Check warning on line 3414 in src/Debugger.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this "if" statement with the enclosing one.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brZcAYReTk2gkJWa&open=AZz_brZcAYReTk2gkJWa&pullRequest=750
edb::address_t r_brk = edb::v1::debuggeeIs32Bit() ? find_linker_hook_address<uint32_t>(process, debugtPointer_) : find_linker_hook_address<uint64_t>(process, debugtPointer_);

if (r_brk) {
Expand Down
4 changes: 2 additions & 2 deletions src/Debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
class QStringListModel;
class QTimer;
class QToolButton;
class QToolButton;

Check warning on line 49 in src/Debugger.h

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this redundant forward declaration; the declaration was already made.

See more on https://sonarcloud.io/project/issues?id=eteran_edb-debugger&issues=AZz_brWeAYReTk2gkJWL&open=AZz_brWeAYReTk2gkJWL&pullRequest=750
class QDragEnterEvent;
class QDropEvent;
class QLabel;
Expand Down Expand Up @@ -170,7 +170,7 @@

private Q_SLOTS:
// the manually connected Register slots
QList<QAction *> currentRegisterContextMenuItems() const;
QList<QAction *> currentRegisterContextMenuItems(QMenu *parent) const;
void mnuRegisterFollowInDump() { followRegisterInDump(false); }
void mnuRegisterFollowInDumpNewTab() { followRegisterInDump(true); }
void mnuRegisterFollowInStack();
Expand Down Expand Up @@ -269,7 +269,7 @@
Result<edb::address_t, QString> getFollowAddress(const Ptr &hexview);

template <class F>
QList<QAction *> getPluginContextMenuItems(const F &f) const;
QList<QAction *> getPluginContextMenuItems(QMenu *parent, const F &f) const;

template <class F, class T>
void addPluginContextMenu(const T &menu, const F &f);
Expand Down