mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-20 13:46:06 +00:00
Astyle pass (cleaning) (#739)
This commit is contained in:
parent
0aace76065
commit
ec815195cf
@ -56,15 +56,15 @@ CutterCore::CutterCore(QObject *parent) :
|
||||
#if defined(APPIMAGE) || defined(MACOS_R2_BUNDLED)
|
||||
auto prefix = QDir(QCoreApplication::applicationDirPath());
|
||||
#ifdef APPIMAGE
|
||||
// Executable is in appdir/bin
|
||||
prefix.cdUp();
|
||||
qInfo() << "Setting r2 prefix =" << prefix.absolutePath() << " for AppImage.";
|
||||
// Executable is in appdir/bin
|
||||
prefix.cdUp();
|
||||
qInfo() << "Setting r2 prefix =" << prefix.absolutePath() << " for AppImage.";
|
||||
#else // MACOS_R2_BUNDLED
|
||||
// Executable is in Contents/MacOS, prefix is Contents/Resources/r2
|
||||
prefix.cdUp();
|
||||
prefix.cd("Resources");
|
||||
prefix.cd("r2");
|
||||
qInfo() << "Setting r2 prefix =" << prefix.absolutePath() << " for macOS Application Bundle.";
|
||||
// Executable is in Contents/MacOS, prefix is Contents/Resources/r2
|
||||
prefix.cdUp();
|
||||
prefix.cd("Resources");
|
||||
prefix.cd("r2");
|
||||
qInfo() << "Setting r2 prefix =" << prefix.absolutePath() << " for macOS Application Bundle.";
|
||||
#endif
|
||||
setConfig("dir.prefix", prefix.absolutePath());
|
||||
#endif
|
||||
@ -1121,8 +1121,7 @@ QList<RVA> CutterCore::getBreakpointsAddresses()
|
||||
QList<BreakpointDescription> bps = getBreakpoints();
|
||||
BreakpointDescription bp;
|
||||
QList<RVA> bpAddresses;
|
||||
foreach (bp, bps)
|
||||
{
|
||||
foreach (bp, bps) {
|
||||
bpAddresses << bp.addr;
|
||||
}
|
||||
|
||||
|
@ -165,18 +165,18 @@ bool CutterApplication::event(QEvent *e)
|
||||
|
||||
void CutterApplication::loadPlugins()
|
||||
{
|
||||
QList<CutterPlugin*> plugins;
|
||||
QList<CutterPlugin *> plugins;
|
||||
QDir pluginsDir(qApp->applicationDirPath());
|
||||
#if defined(Q_OS_WIN)
|
||||
if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
|
||||
pluginsDir.cdUp();
|
||||
#elif defined(Q_OS_MAC)
|
||||
if (pluginsDir.dirName() == "MacOS") {
|
||||
pluginsDir.cdUp();
|
||||
pluginsDir.cdUp();
|
||||
pluginsDir.cdUp();
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_WIN)
|
||||
if (pluginsDir.dirName().toLower() == "debug" || pluginsDir.dirName().toLower() == "release")
|
||||
pluginsDir.cdUp();
|
||||
#elif defined(Q_OS_MAC)
|
||||
if (pluginsDir.dirName() == "MacOS") {
|
||||
pluginsDir.cdUp();
|
||||
pluginsDir.cdUp();
|
||||
pluginsDir.cdUp();
|
||||
}
|
||||
#endif
|
||||
pluginsDir.cd("plugins");
|
||||
foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
|
||||
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
|
||||
|
@ -95,8 +95,10 @@ bool ProcessProxyModel::filterAcceptsRow(int row, const QModelIndex &parent) con
|
||||
|
||||
bool ProcessProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
ProcessDescription leftProc = left.data(ProcessModel::ProcDescriptionRole).value<ProcessDescription>();
|
||||
ProcessDescription rightProc = right.data(ProcessModel::ProcDescriptionRole).value<ProcessDescription>();
|
||||
ProcessDescription leftProc = left.data(
|
||||
ProcessModel::ProcDescriptionRole).value<ProcessDescription>();
|
||||
ProcessDescription rightProc = right.data(
|
||||
ProcessModel::ProcDescriptionRole).value<ProcessDescription>();
|
||||
|
||||
switch (left.column()) {
|
||||
case ProcessModel::PidColumn:
|
||||
@ -150,7 +152,7 @@ void AttachProcDialog::on_buttonBox_rejected()
|
||||
int AttachProcDialog::getPID()
|
||||
{
|
||||
ProcessDescription proc = ui->procTreeView->selectionModel()->currentIndex().data(
|
||||
ProcessModel::ProcDescriptionRole).value<ProcessDescription>();
|
||||
ProcessModel::ProcDescriptionRole).value<ProcessDescription>();
|
||||
return proc.pid;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,8 @@ EditInstructionDialog::EditInstructionDialog(QWidget *parent, bool isEditingByte
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
|
||||
connect(ui->lineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(updatePreview(const QString &)));
|
||||
connect(ui->lineEdit, SIGNAL(textEdited(const QString &)), this,
|
||||
SLOT(updatePreview(const QString &)));
|
||||
}
|
||||
|
||||
EditInstructionDialog::~EditInstructionDialog() {}
|
||||
|
@ -224,7 +224,7 @@ QList<QString> InitialOptionsDialog::getSelectedAdvancedAnalCmds()
|
||||
void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> advanced*/)
|
||||
{
|
||||
main->initUI();
|
||||
|
||||
|
||||
InitialOptions options;
|
||||
|
||||
options.filename = main->getFilename();
|
||||
@ -238,7 +238,8 @@ void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> adv
|
||||
options.binLoadAddr = Core()->math(ui->entry_loadOffset->text());
|
||||
}
|
||||
|
||||
options.mapAddr = Core()->math(ui->entry_mapOffset->text()); // Where to map the file once loaded (-m)
|
||||
options.mapAddr = Core()->math(
|
||||
ui->entry_mapOffset->text()); // Where to map the file once loaded (-m)
|
||||
options.arch = getSelectedArch();
|
||||
options.cpu = getSelectedCPU();
|
||||
options.bits = getSelectedBits();
|
||||
@ -261,19 +262,19 @@ void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> adv
|
||||
options.bbsize = getSelectedBBSize();
|
||||
|
||||
int level = ui->analSlider->value();
|
||||
switch(level) {
|
||||
case 1:
|
||||
options.analCmd = { "aaa" };
|
||||
break;
|
||||
case 2:
|
||||
options.analCmd = { "aaaa" };
|
||||
break;
|
||||
case 3:
|
||||
options.analCmd = getSelectedAdvancedAnalCmds();
|
||||
break;
|
||||
default:
|
||||
options.analCmd = {};
|
||||
break;
|
||||
switch (level) {
|
||||
case 1:
|
||||
options.analCmd = { "aaa" };
|
||||
break;
|
||||
case 2:
|
||||
options.analCmd = { "aaaa" };
|
||||
break;
|
||||
case 3:
|
||||
options.analCmd = getSelectedAdvancedAnalCmds();
|
||||
break;
|
||||
default:
|
||||
options.analCmd = {};
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,8 +10,7 @@
|
||||
#include "AnalTask.h"
|
||||
#include "utils/InitialOptions.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
namespace Ui {
|
||||
class InitialOptionsDialog;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,8 @@ void NewFileDialog::fillIOPluginsList()
|
||||
|
||||
void NewFileDialog::loadFile(const QString &filename)
|
||||
{
|
||||
if (ui->ioPlugin->currentIndex() == 0 && !Core()->tryFile(filename, false) && !ui->checkBox_FilelessOpen->isChecked()) {
|
||||
if (ui->ioPlugin->currentIndex() == 0 && !Core()->tryFile(filename, false)
|
||||
&& !ui->checkBox_FilelessOpen->isChecked()) {
|
||||
QMessageBox msgBox(this);
|
||||
msgBox.setText(tr("Select a new program or a previous one before continuing."));
|
||||
msgBox.exec();
|
||||
@ -364,7 +365,7 @@ void NewFileDialog::loadFile(const QString &filename)
|
||||
InitialOptions options;
|
||||
options.filename = ioFile;
|
||||
main->openNewFile(options);
|
||||
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@ VersionInfoDialog::VersionInfoDialog(QWidget *parent) :
|
||||
|
||||
VersionInfoDialog::~VersionInfoDialog() {}
|
||||
|
||||
void VersionInfoDialog::fillVersionInfo(){
|
||||
void VersionInfoDialog::fillVersionInfo()
|
||||
{
|
||||
|
||||
QJsonDocument doc = Core()->getFileVersionInfo();
|
||||
|
||||
@ -143,7 +144,7 @@ void VersionInfoDialog::fillVersionInfo(){
|
||||
ui->rightLabel->setText("String table");
|
||||
|
||||
// Left tree
|
||||
for (QString key : vs.keys()){
|
||||
for (QString key : vs.keys()) {
|
||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, key);
|
||||
if (vs[key].isDouble())
|
||||
@ -157,7 +158,7 @@ void VersionInfoDialog::fillVersionInfo(){
|
||||
}
|
||||
|
||||
// Right tree
|
||||
for (QString key : strings.keys()){
|
||||
for (QString key : strings.keys()) {
|
||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, key);
|
||||
tempItem->setText(1, strings[key].toString());
|
||||
|
@ -93,14 +93,17 @@ BreakpointProxyModel::BreakpointProxyModel(BreakpointModel *sourceModel, QObject
|
||||
bool BreakpointProxyModel::filterAcceptsRow(int row, const QModelIndex &parent) const
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(row, 0, parent);
|
||||
BreakpointDescription item = index.data(BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointDescription item = index.data(
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
return item.permission.contains(filterRegExp());
|
||||
}
|
||||
|
||||
bool BreakpointProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
BreakpointDescription leftBreakpt = left.data(BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointDescription rightBreakpt = right.data(BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointDescription leftBreakpt = left.data(
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointDescription rightBreakpt = right.data(
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
|
||||
switch (left.column()) {
|
||||
case BreakpointModel::AddrColumn:
|
||||
@ -142,7 +145,7 @@ BreakpointWidget::BreakpointWidget(MainWindow *main, QAction *action) :
|
||||
connect(ui->delAllBreakpoints, &QAbstractButton::clicked, Core(), &CutterCore::delAllBreakpoints);
|
||||
ui->breakpointTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->breakpointTreeView, SIGNAL(customContextMenuRequested(const QPoint &)),
|
||||
this, SLOT(showBreakpointContextMenu(const QPoint &)));
|
||||
this, SLOT(showBreakpointContextMenu(const QPoint &)));
|
||||
}
|
||||
|
||||
BreakpointWidget::~BreakpointWidget() {}
|
||||
@ -165,7 +168,8 @@ void BreakpointWidget::setScrollMode()
|
||||
|
||||
void BreakpointWidget::on_breakpointTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
BreakpointDescription item = index.data(BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointDescription item = index.data(
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
Core()->seek(item.addr);
|
||||
}
|
||||
|
||||
@ -200,14 +204,14 @@ void BreakpointWidget::addBreakpointDialog()
|
||||
void BreakpointWidget::delBreakpoint()
|
||||
{
|
||||
BreakpointDescription bp = ui->breakpointTreeView->selectionModel()->currentIndex().data(
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
Core()->delBreakpoint(bp.addr);
|
||||
}
|
||||
|
||||
void BreakpointWidget::toggleBreakpoint()
|
||||
{
|
||||
BreakpointDescription bp = ui->breakpointTreeView->selectionModel()->currentIndex().data(
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
BreakpointModel::BreakpointDescriptionRole).value<BreakpointDescription>();
|
||||
if (bp.enabled) {
|
||||
Core()->disableBreakpoint(bp.addr);
|
||||
} else {
|
||||
|
@ -11,9 +11,8 @@
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class BreakpointWidget;
|
||||
namespace Ui {
|
||||
class BreakpointWidget;
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ int CommentsModel::rowCount(const QModelIndex &parent) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CommentsModel::columnCount(const QModelIndex&) const
|
||||
int CommentsModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return (isNested()
|
||||
? static_cast<int>(CommentsModel::NestedColumnCount)
|
||||
@ -92,8 +92,7 @@ QVariant CommentsModel::data(const QModelIndex &index, int role) const
|
||||
comment = comments->at(commentIndex);
|
||||
}
|
||||
|
||||
switch (role)
|
||||
{
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
if (isNested()) {
|
||||
if (isSubnode) {
|
||||
|
@ -29,7 +29,8 @@ public:
|
||||
enum NestedColumn { OffsetNestedColumn = 0, CommentNestedColumn, NestedColumnCount };
|
||||
enum Role { CommentDescriptionRole = Qt::UserRole, FunctionRole };
|
||||
|
||||
CommentsModel(QList<CommentDescription> *comments, QMap<QString, QList<CommentDescription>> *nestedComments,
|
||||
CommentsModel(QList<CommentDescription> *comments,
|
||||
QMap<QString, QList<CommentDescription>> *nestedComments,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
|
@ -179,7 +179,8 @@ void ConsoleWidget::executeCommand(const QString &command)
|
||||
QString cmd_line = "[" + RAddressString(Core()->getOffset()) + "]> " + command + "\n";
|
||||
|
||||
commandTask = QSharedPointer<CommandTask>(new CommandTask(command));
|
||||
connect(commandTask.data(), &CommandTask::finished, this, [this, cmd_line, command] (const QString &result) {
|
||||
connect(commandTask.data(), &CommandTask::finished, this, [this, cmd_line,
|
||||
command] (const QString & result) {
|
||||
ui->outputTextEdit->appendPlainText(cmd_line + result);
|
||||
scrollOutputToEnd();
|
||||
historyAdd(command);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "CutterSeekableWidget.h"
|
||||
|
||||
CutterSeekableWidget::CutterSeekableWidget(QObject *parent)
|
||||
:
|
||||
:
|
||||
QObject(parent)
|
||||
{
|
||||
connect(Core(), &CutterCore::seekChanged, this, &CutterSeekableWidget::onSeekChanged);
|
||||
|
@ -62,7 +62,7 @@ void Dashboard::updateContents()
|
||||
this->ui->relroEdit->setText(relro);
|
||||
}
|
||||
|
||||
this->ui->baddrEdit->setText("0x"+QString::number(Core()->get_baddr(), 16));
|
||||
this->ui->baddrEdit->setText("0x" + QString::number(Core()->get_baddr(), 16));
|
||||
|
||||
if (item2["va"].toBool() == true) {
|
||||
this->ui->vaEdit->setText("True");
|
||||
@ -158,10 +158,10 @@ void Dashboard::updateContents()
|
||||
QStringList stats = Core()->getStats();
|
||||
|
||||
// Check if signature info and version info available
|
||||
if (Core()->getSignatureInfo().isEmpty()){
|
||||
if (Core()->getSignatureInfo().isEmpty()) {
|
||||
ui->certificateButton->setEnabled(false);
|
||||
}
|
||||
if (Core()->getFileVersionInfo().isEmpty()){
|
||||
if (Core()->getFileVersionInfo().isEmpty()) {
|
||||
ui->versioninfoButton->setEnabled(false);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ void Dashboard::on_versioninfoButton_clicked()
|
||||
|
||||
static QDialog *infoDialog = nullptr;
|
||||
|
||||
if (!infoDialog){
|
||||
if (!infoDialog) {
|
||||
infoDialog = new VersionInfoDialog(this);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,8 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
|
||||
actionContinue->setShortcut(QKeySequence(Qt::Key_F5));
|
||||
actionContinueUntilMain = new QAction(continueUntilMainIcon, tr("Continue until main"), parent);
|
||||
actionContinueUntilCall = new QAction(continueUntilCallIcon, tr("Continue until call"), parent);
|
||||
actionContinueUntilSyscall = new QAction(continueUntilSyscallIcon, tr("Continue until syscall"), parent);
|
||||
actionContinueUntilSyscall = new QAction(continueUntilSyscallIcon, tr("Continue until syscall"),
|
||||
parent);
|
||||
actionStep = new QAction(stepIcon, tr("Step"), parent);
|
||||
actionStep->setShortcut(QKeySequence(Qt::Key_F7));
|
||||
actionStepOver = new QAction(stepOverIcon, tr("Step over"), parent);
|
||||
@ -52,7 +53,8 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
|
||||
|
||||
QToolButton *continueUntilButton = new QToolButton;
|
||||
continueUntilButton->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
connect(continueUntilButton, &QToolButton::triggered, continueUntilButton, &QToolButton::setDefaultAction);
|
||||
connect(continueUntilButton, &QToolButton::triggered, continueUntilButton,
|
||||
&QToolButton::setDefaultAction);
|
||||
QMenu *continueUntilMenu = new QMenu;
|
||||
continueUntilMenu->addAction(actionContinueUntilMain);
|
||||
continueUntilMenu->addAction(actionContinueUntilCall);
|
||||
@ -68,7 +70,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
|
||||
addAction(actionStepOver);
|
||||
|
||||
connect(actionStop, &QAction::triggered, Core(), &CutterCore::stopDebug);
|
||||
connect(actionStop, &QAction::triggered, [=]() {
|
||||
connect(actionStop, &QAction::triggered, [ = ]() {
|
||||
actionContinue->setVisible(true);
|
||||
actionStart->setVisible(true);
|
||||
actionStartEmul->setVisible(true);
|
||||
@ -77,7 +79,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
|
||||
this->colorToolbar(false);
|
||||
});
|
||||
connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug);
|
||||
connect(actionStart, &QAction::triggered, [=]() {
|
||||
connect(actionStart, &QAction::triggered, [ = ]() {
|
||||
QString filename = Core()->getConfig("file.lastpath");
|
||||
QFileInfo info(filename);
|
||||
if (!info.isExecutable()) {
|
||||
@ -93,7 +95,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
|
||||
});
|
||||
connect(actionAttach, &QAction::triggered, this, &DebugToolbar::attachProcessDialog);
|
||||
connect(actionStartEmul, &QAction::triggered, Core(), &CutterCore::startEmulation);
|
||||
connect(actionStartEmul, &QAction::triggered, [=]() {
|
||||
connect(actionStartEmul, &QAction::triggered, [ = ]() {
|
||||
actionContinue->setVisible(false);
|
||||
actionStart->setVisible(false);
|
||||
actionAttach->setVisible(false);
|
||||
|
@ -116,7 +116,8 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent)
|
||||
void DisassemblerGraphView::connectSeekChanged(bool disconn)
|
||||
{
|
||||
if (disconn) {
|
||||
disconnect(seekable, &CutterSeekableWidget::seekChanged, this, &DisassemblerGraphView::onSeekChanged);
|
||||
disconnect(seekable, &CutterSeekableWidget::seekChanged, this,
|
||||
&DisassemblerGraphView::onSeekChanged);
|
||||
} else {
|
||||
connect(seekable, &CutterSeekableWidget::seekChanged, this, &DisassemblerGraphView::onSeekChanged);
|
||||
}
|
||||
@ -448,12 +449,12 @@ void DisassemblerGraphView::drawBlock(QPainter &p, GraphView::GraphBlock &block)
|
||||
int tokenEnd = pos + highlight_token->content.length();
|
||||
|
||||
if ((pos > 0 && instr.plainText[pos - 1].isLetterOrNumber())
|
||||
|| (tokenEnd < instr.plainText.length() && instr.plainText[tokenEnd].isLetterOrNumber())) {
|
||||
|| (tokenEnd < instr.plainText.length() && instr.plainText[tokenEnd].isLetterOrNumber())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
p.fillRect(QRect(block.x + charWidth * 3 + pos * charWidth, y, highlight_token->length * charWidth,
|
||||
charHeight), disassemblySelectionColor.lighter(250));
|
||||
charHeight), disassemblySelectionColor.lighter(250));
|
||||
}
|
||||
|
||||
y += int(instr.text.lines.size()) * charHeight;
|
||||
@ -744,7 +745,7 @@ void DisassemblerGraphView::seekPrev()
|
||||
}
|
||||
}
|
||||
|
||||
DisassemblerGraphView::Token * DisassemblerGraphView::getToken(Instr * instr, int x)
|
||||
DisassemblerGraphView::Token *DisassemblerGraphView::getToken(Instr *instr, int x)
|
||||
{
|
||||
int clickedCharPos = x / charWidth - 3;
|
||||
|
||||
@ -759,7 +760,7 @@ DisassemblerGraphView::Token * DisassemblerGraphView::getToken(Instr * instr, in
|
||||
QRegularExpressionMatch match = i.next();
|
||||
|
||||
if (match.capturedStart() <= clickedCharPos && match.capturedEnd() > clickedCharPos) {
|
||||
Token * t = new Token;
|
||||
Token *t = new Token;
|
||||
t->start = match.capturedStart();
|
||||
t->length = match.capturedLength();
|
||||
t->content = match.captured();
|
||||
|
@ -65,7 +65,7 @@ class DisassemblerGraphView : public GraphView
|
||||
int start;
|
||||
int length;
|
||||
QString type;
|
||||
Instr * instr;
|
||||
Instr *instr;
|
||||
QString name;
|
||||
QString content;
|
||||
};
|
||||
@ -168,7 +168,7 @@ private:
|
||||
|
||||
void initFont();
|
||||
void prepareGraphNode(GraphBlock &block);
|
||||
Token *getToken(Instr * instr, int x);
|
||||
Token *getToken(Instr *instr, int x);
|
||||
RVA getAddrForMouseEvent(GraphBlock &block, QPoint *point);
|
||||
Instr *getInstrForMouseEvent(GraphBlock &block, QPoint *point);
|
||||
DisassemblyBlock *blockForAddress(RVA addr);
|
||||
|
@ -125,7 +125,8 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action)
|
||||
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot()));
|
||||
|
||||
connect(this, &QDockWidget::visibilityChanged, this, [](bool visibility) {
|
||||
bool emptyGraph = (Core()->getMemoryWidgetPriority() == CutterCore::MemoryWidgetType::Graph && Core()->isGraphEmpty());
|
||||
bool emptyGraph = (Core()->getMemoryWidgetPriority() == CutterCore::MemoryWidgetType::Graph
|
||||
&& Core()->isGraphEmpty());
|
||||
if (visibility && !emptyGraph) {
|
||||
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
|
||||
}
|
||||
@ -232,7 +233,7 @@ void DisassemblyWidget::refreshDisasm(RVA offset)
|
||||
break;
|
||||
}
|
||||
cursor.insertHtml(line.text);
|
||||
if(Core()->isBreakpoint(breakpoints, line.offset)) {
|
||||
if (Core()->isBreakpoint(breakpoints, line.offset)) {
|
||||
QTextBlockFormat f;
|
||||
f.setBackground(ConfigColor("gui.breakpoint_background"));
|
||||
cursor.setBlockFormat(f);
|
||||
@ -305,12 +306,14 @@ bool DisassemblyWidget::updateMaxLines()
|
||||
return false;
|
||||
}
|
||||
|
||||
void DisassemblyWidget::zoomIn() {
|
||||
void DisassemblyWidget::zoomIn()
|
||||
{
|
||||
mDisasTextEdit->zoomIn();
|
||||
updateMaxLines();
|
||||
}
|
||||
|
||||
void DisassemblyWidget::zoomOut() {
|
||||
void DisassemblyWidget::zoomOut()
|
||||
{
|
||||
mDisasTextEdit->zoomOut();
|
||||
updateMaxLines();
|
||||
}
|
||||
@ -543,7 +546,7 @@ void DisassemblyWidget::moveCursorRelative(bool up, bool page)
|
||||
int overflowLines = oldTopLine - maxLines;
|
||||
if (overflowLines > 0) {
|
||||
while (lines[overflowLines - 1].offset == lines[overflowLines].offset
|
||||
&& overflowLines < lines.length() - 1) {
|
||||
&& overflowLines < lines.length() - 1) {
|
||||
overflowLines++;
|
||||
}
|
||||
offset = lines[overflowLines].offset;
|
||||
|
@ -354,24 +354,24 @@ bool FunctionSortFilterProxyModel::lessThan(const QModelIndex &left, const QMode
|
||||
case FunctionModel::NameColumn:
|
||||
return left_function.name < right_function.name;
|
||||
case FunctionModel::NargsColumn:
|
||||
if (left_function.nargs != right_function.nargs)
|
||||
return left_function.nargs < right_function.nargs;
|
||||
break;
|
||||
if (left_function.nargs != right_function.nargs)
|
||||
return left_function.nargs < right_function.nargs;
|
||||
break;
|
||||
case FunctionModel::NbbsColumn:
|
||||
if (left_function.nbbs != right_function.nbbs)
|
||||
return left_function.nbbs < right_function.nbbs;
|
||||
break;
|
||||
if (left_function.nbbs != right_function.nbbs)
|
||||
return left_function.nbbs < right_function.nbbs;
|
||||
break;
|
||||
case FunctionModel::NlocalsColumn:
|
||||
if (left_function.nlocals != right_function.nlocals)
|
||||
return left_function.nlocals < right_function.nlocals;
|
||||
break;
|
||||
if (left_function.nlocals != right_function.nlocals)
|
||||
return left_function.nlocals < right_function.nlocals;
|
||||
break;
|
||||
case FunctionModel::CcColumn:
|
||||
if (left_function.cc != right_function.cc)
|
||||
return left_function.cc < right_function.cc;
|
||||
break;
|
||||
if (left_function.cc != right_function.cc)
|
||||
return left_function.cc < right_function.cc;
|
||||
break;
|
||||
case FunctionModel::CalltypeColumn:
|
||||
return left_function.calltype < right_function.calltype;
|
||||
break;
|
||||
return left_function.calltype < right_function.calltype;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -445,7 +445,8 @@ void FunctionsWidget::refreshTree()
|
||||
}
|
||||
|
||||
task = QSharedPointer<FunctionsTask>(new FunctionsTask());
|
||||
connect(task.data(), &FunctionsTask::fetchFinished, this, [this] (const QList<FunctionDescription> &functions) {
|
||||
connect(task.data(), &FunctionsTask::fetchFinished,
|
||||
this, [this] (const QList<FunctionDescription> &functions) {
|
||||
functionModel->beginReloadFunctions();
|
||||
|
||||
this->functions = functions;
|
||||
|
@ -43,7 +43,8 @@ public:
|
||||
static const int IsImportRole = Qt::UserRole + 1;
|
||||
|
||||
enum Column { NameColumn = 0, SizeColumn, ImportColumn, OffsetColumn, NargsColumn, NbbsColumn,
|
||||
NlocalsColumn, CcColumn, CalltypeColumn, ColumnCount };
|
||||
NlocalsColumn, CcColumn, CalltypeColumn, ColumnCount
|
||||
};
|
||||
|
||||
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress,
|
||||
bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = nullptr);
|
||||
|
@ -89,8 +89,10 @@ bool HeadersProxyModel::filterAcceptsRow(int row, const QModelIndex &parent) con
|
||||
|
||||
bool HeadersProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
HeaderDescription leftHeader = left.data(HeadersModel::HeaderDescriptionRole).value<HeaderDescription>();
|
||||
HeaderDescription rightHeader = right.data(HeadersModel::HeaderDescriptionRole).value<HeaderDescription>();
|
||||
HeaderDescription leftHeader = left.data(
|
||||
HeadersModel::HeaderDescriptionRole).value<HeaderDescription>();
|
||||
HeaderDescription rightHeader = right.data(
|
||||
HeadersModel::HeaderDescriptionRole).value<HeaderDescription>();
|
||||
|
||||
switch (left.column()) {
|
||||
case HeadersModel::OffsetColumn:
|
||||
|
@ -12,9 +12,8 @@
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class HeadersWidget;
|
||||
namespace Ui {
|
||||
class HeadersWidget;
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,10 +15,10 @@ ImportsModel::ImportsModel(QList<ImportDescription> *imports, QObject *parent) :
|
||||
|
||||
int ImportsModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid()? 0 : imports->count();
|
||||
return parent.isValid() ? 0 : imports->count();
|
||||
}
|
||||
|
||||
int ImportsModel::columnCount(const QModelIndex&) const
|
||||
int ImportsModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return ImportsModel::ColumnCount;
|
||||
}
|
||||
@ -26,8 +26,7 @@ int ImportsModel::columnCount(const QModelIndex&) const
|
||||
QVariant ImportsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const ImportDescription &import = imports->at(index.row());
|
||||
switch (role)
|
||||
{
|
||||
switch (role) {
|
||||
case Qt::ForegroundRole:
|
||||
if (index.column() < ImportsModel::ColumnCount) {
|
||||
if (banned.match(import.name).hasMatch())
|
||||
@ -35,14 +34,13 @@ QVariant ImportsModel::data(const QModelIndex &index, int role) const
|
||||
}
|
||||
break;
|
||||
case Qt::DisplayRole:
|
||||
switch(index.column())
|
||||
{
|
||||
switch (index.column()) {
|
||||
case ImportsModel::AddressColumn:
|
||||
return RAddressString(import.plt);
|
||||
case ImportsModel::TypeColumn:
|
||||
return import.type;
|
||||
case ImportsModel::SafetyColumn:
|
||||
return banned.match(import.name).hasMatch()? tr("Unsafe") : QStringLiteral("");
|
||||
return banned.match(import.name).hasMatch() ? tr("Unsafe") : QStringLiteral("");
|
||||
case ImportsModel::NameColumn:
|
||||
return import.name;
|
||||
default:
|
||||
@ -61,10 +59,8 @@ QVariant ImportsModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
QVariant ImportsModel::headerData(int section, Qt::Orientation, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole)
|
||||
{
|
||||
switch(section)
|
||||
{
|
||||
if (role == Qt::DisplayRole) {
|
||||
switch (section) {
|
||||
case ImportsModel::AddressColumn:
|
||||
return tr("Address");
|
||||
case ImportsModel::TypeColumn:
|
||||
|
@ -25,20 +25,20 @@ class ImportsModel : public QAbstractTableModel
|
||||
|
||||
private:
|
||||
const QRegularExpression banned = QRegularExpression(QStringLiteral(
|
||||
"\\A(\\w\\.)*(system|strcpy|strcpyA|strcpyW|wcscpy|_tcscpy|_mbscpy|StrCpy|StrCpyA|StrCpyW|lstrcpy|lstrcpyA|lstrcpyW"
|
||||
"|_tccpy|_mbccpy|_ftcscpy|strcat|strcatA|strcatW|wcscat|_tcscat|_mbscat|StrCat|StrCatA|StrCatW|lstrcat|lstrcatA|"
|
||||
"lstrcatW|StrCatBuff|StrCatBuffA|StrCatBuffW|StrCatChainW|_tccat|_mbccat|_ftcscat|sprintfW|sprintfA|wsprintf|wsprintfW|"
|
||||
"wsprintfA|sprintf|swprintf|_stprintf|wvsprintf|wvsprintfA|wvsprintfW|vsprintf|_vstprintf|vswprintf|strncpy|wcsncpy|"
|
||||
"_tcsncpy|_mbsncpy|_mbsnbcpy|StrCpyN|StrCpyNA|StrCpyNW|StrNCpy|strcpynA|StrNCpyA|StrNCpyW|lstrcpyn|lstrcpynA|lstrcpynW|"
|
||||
"strncat|wcsncat|_tcsncat|_mbsncat|_mbsnbcat|StrCatN|StrCatNA|StrCatNW|StrNCat|StrNCatA|StrNCatW|lstrncat|lstrcatnA|"
|
||||
"lstrcatnW|lstrcatn|gets|_getts|_gettws|IsBadWritePtr|IsBadHugeWritePtr|IsBadReadPtr|IsBadHugeReadPtr|IsBadCodePtr|"
|
||||
"IsBadStringPtr|memcpy|RtlCopyMemory|CopyMemory|wmemcpy|wnsprintf|wnsprintfA|wnsprintfW|_snwprintf|_snprintf|_sntprintf|"
|
||||
"_vsnprintf|vsnprintf|_vsnwprintf|_vsntprintf|wvnsprintf|wvnsprintfA|wvnsprintfW|strtok|_tcstok|wcstok|_mbstok|makepath|"
|
||||
"_tmakepath| _makepath|_wmakepath|_splitpath|_tsplitpath|_wsplitpath|scanf|wscanf|_tscanf|sscanf|swscanf|_stscanf|snscanf|"
|
||||
"snwscanf|_sntscanf|_itoa|_itow|_i64toa|_i64tow|_ui64toa|_ui64tot|_ui64tow|_ultoa|_ultot|_ultow|CharToOem|CharToOemA|CharToOemW|"
|
||||
"OemToChar|OemToCharA|OemToCharW|CharToOemBuffA|CharToOemBuffW|alloca|_alloca|strlen|wcslen|_mbslen|_mbstrlen|StrLen|lstrlen|"
|
||||
"ChangeWindowMessageFilter)\\z"
|
||||
));
|
||||
"\\A(\\w\\.)*(system|strcpy|strcpyA|strcpyW|wcscpy|_tcscpy|_mbscpy|StrCpy|StrCpyA|StrCpyW|lstrcpy|lstrcpyA|lstrcpyW"
|
||||
"|_tccpy|_mbccpy|_ftcscpy|strcat|strcatA|strcatW|wcscat|_tcscat|_mbscat|StrCat|StrCatA|StrCatW|lstrcat|lstrcatA|"
|
||||
"lstrcatW|StrCatBuff|StrCatBuffA|StrCatBuffW|StrCatChainW|_tccat|_mbccat|_ftcscat|sprintfW|sprintfA|wsprintf|wsprintfW|"
|
||||
"wsprintfA|sprintf|swprintf|_stprintf|wvsprintf|wvsprintfA|wvsprintfW|vsprintf|_vstprintf|vswprintf|strncpy|wcsncpy|"
|
||||
"_tcsncpy|_mbsncpy|_mbsnbcpy|StrCpyN|StrCpyNA|StrCpyNW|StrNCpy|strcpynA|StrNCpyA|StrNCpyW|lstrcpyn|lstrcpynA|lstrcpynW|"
|
||||
"strncat|wcsncat|_tcsncat|_mbsncat|_mbsnbcat|StrCatN|StrCatNA|StrCatNW|StrNCat|StrNCatA|StrNCatW|lstrncat|lstrcatnA|"
|
||||
"lstrcatnW|lstrcatn|gets|_getts|_gettws|IsBadWritePtr|IsBadHugeWritePtr|IsBadReadPtr|IsBadHugeReadPtr|IsBadCodePtr|"
|
||||
"IsBadStringPtr|memcpy|RtlCopyMemory|CopyMemory|wmemcpy|wnsprintf|wnsprintfA|wnsprintfW|_snwprintf|_snprintf|_sntprintf|"
|
||||
"_vsnprintf|vsnprintf|_vsnwprintf|_vsntprintf|wvnsprintf|wvnsprintfA|wvnsprintfW|strtok|_tcstok|wcstok|_mbstok|makepath|"
|
||||
"_tmakepath| _makepath|_wmakepath|_splitpath|_tsplitpath|_wsplitpath|scanf|wscanf|_tscanf|sscanf|swscanf|_stscanf|snscanf|"
|
||||
"snwscanf|_sntscanf|_itoa|_itow|_i64toa|_i64tow|_ui64toa|_ui64tot|_ui64tow|_ultoa|_ultot|_ultow|CharToOem|CharToOemA|CharToOemW|"
|
||||
"OemToChar|OemToCharA|OemToCharW|CharToOemBuffA|CharToOemBuffW|alloca|_alloca|strlen|wcslen|_mbslen|_mbstrlen|StrLen|lstrlen|"
|
||||
"ChangeWindowMessageFilter)\\z"
|
||||
));
|
||||
QList<ImportDescription> *imports;
|
||||
|
||||
public:
|
||||
|
@ -87,14 +87,17 @@ MemoryProxyModel::MemoryProxyModel(MemoryMapModel *sourceModel, QObject *parent)
|
||||
bool MemoryProxyModel::filterAcceptsRow(int row, const QModelIndex &parent) const
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(row, 0, parent);
|
||||
MemoryMapDescription item = index.data(MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
MemoryMapDescription item = index.data(
|
||||
MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
return item.name.contains(filterRegExp());
|
||||
}
|
||||
|
||||
bool MemoryProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
MemoryMapDescription leftMemMap = left.data(MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
MemoryMapDescription rightMemMap = right.data(MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
MemoryMapDescription leftMemMap = left.data(
|
||||
MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
MemoryMapDescription rightMemMap = right.data(
|
||||
MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
|
||||
switch (left.column()) {
|
||||
case MemoryMapModel::AddrStartColumn:
|
||||
@ -149,6 +152,7 @@ void MemoryMapWidget::setScrollMode()
|
||||
|
||||
void MemoryMapWidget::on_memoryTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
MemoryMapDescription item = index.data(MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
MemoryMapDescription item = index.data(
|
||||
MemoryMapModel::MemoryDescriptionRole).value<MemoryMapDescription>();
|
||||
Core()->seek(item.addrStart);
|
||||
}
|
||||
|
@ -11,9 +11,8 @@
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MemoryMapWidget;
|
||||
namespace Ui {
|
||||
class MemoryMapWidget;
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,15 +136,15 @@ RegisterRefsWidget::RegisterRefsWidget(MainWindow *main, QAction *action) :
|
||||
setScrollMode();
|
||||
connect(Core(), &CutterCore::refreshAll, this, &RegisterRefsWidget::refreshRegisterRef);
|
||||
connect(Core(), &CutterCore::registersChanged, this, &RegisterRefsWidget::refreshRegisterRef);
|
||||
connect(actionCopyValue, &QAction::triggered, [=] () {
|
||||
connect(actionCopyValue, &QAction::triggered, [ = ] () {
|
||||
copyClip(RegisterRefModel::ValueColumn);
|
||||
});
|
||||
connect(actionCopyRef, &QAction::triggered, [=] () {
|
||||
connect(actionCopyRef, &QAction::triggered, [ = ] () {
|
||||
copyClip(RegisterRefModel::RefColumn);
|
||||
});
|
||||
ui->registerRefTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->registerRefTreeView, SIGNAL(customContextMenuRequested(const QPoint &)),
|
||||
this, SLOT(showRegRefContextMenu(const QPoint &)));
|
||||
this, SLOT(showRegRefContextMenu(const QPoint &)));
|
||||
}
|
||||
|
||||
RegisterRefsWidget::~RegisterRefsWidget() {}
|
||||
@ -186,7 +186,8 @@ void RegisterRefsWidget::showRegRefContextMenu(const QPoint &pt)
|
||||
void RegisterRefsWidget::copyClip(int column)
|
||||
{
|
||||
int row = ui->registerRefTreeView->selectionModel()->currentIndex().row();
|
||||
QString value = ui->registerRefTreeView->selectionModel()->currentIndex().sibling(row, column).data().toString();
|
||||
QString value = ui->registerRefTreeView->selectionModel()->currentIndex().sibling(row,
|
||||
column).data().toString();
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(value);
|
||||
}
|
@ -76,7 +76,7 @@ void RegistersWidget::setRegisterGrid()
|
||||
// add label and register value to grid
|
||||
registerLayout->addWidget(registerLabel, i, col);
|
||||
registerLayout->addWidget(registerEditValue, i, col + 1);
|
||||
connect(registerEditValue, &QLineEdit::editingFinished, [=]() {
|
||||
connect(registerEditValue, &QLineEdit::editingFinished, [ = ]() {
|
||||
QString regNameString = registerLabel->text();
|
||||
QString regValueString = registerEditValue->text();
|
||||
Core()->setRegister(regNameString, regValueString);
|
||||
|
@ -14,7 +14,7 @@ int RelocsModel::rowCount(const QModelIndex &parent) const
|
||||
return parent.isValid() ? 0 : relocs->count();
|
||||
}
|
||||
|
||||
int RelocsModel::columnCount(const QModelIndex&) const
|
||||
int RelocsModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return RelocsModel::ColumnCount;
|
||||
}
|
||||
@ -22,11 +22,9 @@ int RelocsModel::columnCount(const QModelIndex&) const
|
||||
QVariant RelocsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const RelocDescription &reloc = relocs->at(index.row());
|
||||
switch (role)
|
||||
{
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column())
|
||||
{
|
||||
switch (index.column()) {
|
||||
case RelocsModel::VAddrColumn:
|
||||
return RAddressString(reloc.vaddr);
|
||||
case RelocsModel::TypeColumn:
|
||||
@ -50,8 +48,7 @@ QVariant RelocsModel::data(const QModelIndex &index, int role) const
|
||||
QVariant RelocsModel::headerData(int section, Qt::Orientation, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole)
|
||||
switch (section)
|
||||
{
|
||||
switch (section) {
|
||||
case RelocsModel::VAddrColumn:
|
||||
return tr("Address");
|
||||
case RelocsModel::TypeColumn:
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
enum Column { VAddrColumn = 0, TypeColumn, NameColumn, ColumnCount };
|
||||
enum Role { RelocDescriptionRole = Qt::UserRole, AddressRole };
|
||||
|
||||
RelocsModel(QList<RelocDescription> *relocs, QObject* parent = nullptr);
|
||||
RelocsModel(QList<RelocDescription> *relocs, QObject *parent = nullptr);
|
||||
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
|
@ -146,7 +146,7 @@ SearchWidget::SearchWidget(MainWindow *main, QAction *action) :
|
||||
});
|
||||
|
||||
connect(ui->searchspaceCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[=](int index){ updatePlaceholderText(index);});
|
||||
[ = ](int index) { updatePlaceholderText(index);});
|
||||
|
||||
}
|
||||
|
||||
@ -206,20 +206,20 @@ void SearchWidget::setScrollMode()
|
||||
|
||||
void SearchWidget::updatePlaceholderText(int index)
|
||||
{
|
||||
switch(index){
|
||||
case 1: // string
|
||||
ui->filterLineEdit->setPlaceholderText("foobar");
|
||||
break;
|
||||
case 2: // hex string
|
||||
ui->filterLineEdit->setPlaceholderText("deadbeef");
|
||||
break;
|
||||
case 3: // ROP gadgets
|
||||
ui->filterLineEdit->setPlaceholderText("pop,,pop");
|
||||
break;
|
||||
case 4: // 32bit value
|
||||
ui->filterLineEdit->setPlaceholderText("0xdeadbeef");
|
||||
break;
|
||||
default:
|
||||
ui->filterLineEdit->setPlaceholderText("jmp rax");
|
||||
switch (index) {
|
||||
case 1: // string
|
||||
ui->filterLineEdit->setPlaceholderText("foobar");
|
||||
break;
|
||||
case 2: // hex string
|
||||
ui->filterLineEdit->setPlaceholderText("deadbeef");
|
||||
break;
|
||||
case 3: // ROP gadgets
|
||||
ui->filterLineEdit->setPlaceholderText("pop,,pop");
|
||||
break;
|
||||
case 4: // 32bit value
|
||||
ui->filterLineEdit->setPlaceholderText("0xdeadbeef");
|
||||
break;
|
||||
default:
|
||||
ui->filterLineEdit->setPlaceholderText("jmp rax");
|
||||
}
|
||||
}
|
||||
|
@ -69,13 +69,17 @@ void StackWidget::setStackGrid()
|
||||
QStandardItem *rowRef = new QStandardItem(ref);
|
||||
modelStack->setItem(i, 2, rowRef);
|
||||
if (refObject.toString().contains("ascii") && refObject.toString().count("-->") == 1) {
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(243, 156, 17)), Qt::ForegroundRole); // orange
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(243, 156, 17)),
|
||||
Qt::ForegroundRole); // orange
|
||||
} else if (ref.contains("program R X") && ref.count("-->") == 0) {
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(Qt::red)), Qt::ForegroundRole);
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(Qt::red)),
|
||||
Qt::ForegroundRole);
|
||||
} else if (ref.contains("stack") && ref.count("-->") == 0) {
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(Qt::cyan)), Qt::ForegroundRole);
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(Qt::cyan)),
|
||||
Qt::ForegroundRole);
|
||||
} else if (ref.contains("library") && ref.count("-->") == 0) {
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(Qt::green)), Qt::ForegroundRole);
|
||||
modelStack->setData(modelStack->index(i, 2, QModelIndex()), QVariant(QColor(Qt::green)),
|
||||
Qt::ForegroundRole);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
@ -178,7 +178,8 @@ void StringsWidget::refreshStrings()
|
||||
}
|
||||
|
||||
task = QSharedPointer<StringsTask>(new StringsTask());
|
||||
connect(task.data(), &StringsTask::stringSearchFinished, this, &StringsWidget::stringSearchFinished);
|
||||
connect(task.data(), &StringsTask::stringSearchFinished, this,
|
||||
&StringsWidget::stringSearchFinished);
|
||||
Core()->getAsyncTaskManager()->start(task);
|
||||
}
|
||||
|
||||
|
@ -186,8 +186,8 @@ void VTablesWidget::on_vTableTreeView_doubleClicked(const QModelIndex &index)
|
||||
QModelIndex parent = index.parent();
|
||||
if (parent.isValid())
|
||||
Core()->seek(index.data(
|
||||
VTableModel::VTableDescriptionRole).value<ClassMethodDescription>().addr);
|
||||
VTableModel::VTableDescriptionRole).value<ClassMethodDescription>().addr);
|
||||
else
|
||||
Core()->seek(index.data(
|
||||
VTableModel::VTableDescriptionRole).value<VTableDescription>().addr);
|
||||
VTableModel::VTableDescriptionRole).value<VTableDescription>().addr);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void VisualNavbar::paintEvent(QPaintEvent *event)
|
||||
if (statsWidth < w) {
|
||||
statsWidth = nextPow2(w);
|
||||
fetch = true;
|
||||
} else if (statsWidth > w*4) {
|
||||
} else if (statsWidth > w * 4) {
|
||||
statsWidth = statsWidth > 0 ? statsWidth / 2 : 0;
|
||||
fetch = true;
|
||||
}
|
||||
@ -110,7 +110,7 @@ void VisualNavbar::fetchStats()
|
||||
stats = Core()->getBlockStatistics(statsWidth);
|
||||
}
|
||||
|
||||
enum class DataType: int { Empty, Code, String, Symbol, Count };
|
||||
enum class DataType : int { Empty, Code, String, Symbol, Count };
|
||||
|
||||
void VisualNavbar::updateGraphicsScene()
|
||||
{
|
||||
|
@ -44,10 +44,10 @@ QVariant ZignaturesModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
case Qt::ToolTipRole: {
|
||||
QString tmp = QString("Graph:\n\n Cyclomatic complexity: " + RSizeString(zignature.cc) +
|
||||
"\n Nodes / basicblocks: " + RSizeString(zignature.nbbs) +
|
||||
"\n Edges: " + RSizeString(zignature.edges) +
|
||||
"\n Ebbs: " + RSizeString(zignature.ebbs) +
|
||||
"\n\nRefs:\n");
|
||||
"\n Nodes / basicblocks: " + RSizeString(zignature.nbbs) +
|
||||
"\n Edges: " + RSizeString(zignature.edges) +
|
||||
"\n Ebbs: " + RSizeString(zignature.ebbs) +
|
||||
"\n\nRefs:\n");
|
||||
for (QString ref : zignature.refs) {
|
||||
tmp.append("\n " + ref);
|
||||
}
|
||||
@ -97,14 +97,17 @@ ZignaturesProxyModel::ZignaturesProxyModel(ZignaturesModel *sourceModel, QObject
|
||||
bool ZignaturesProxyModel::filterAcceptsRow(int row, const QModelIndex &parent) const
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(row, 0, parent);
|
||||
ZignatureDescription item = index.data(ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
ZignatureDescription item = index.data(
|
||||
ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
return item.name.contains(filterRegExp());
|
||||
}
|
||||
|
||||
bool ZignaturesProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
ZignatureDescription leftZignature = left.data(ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
ZignatureDescription rightZignature = right.data(ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
ZignatureDescription leftZignature = left.data(
|
||||
ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
ZignatureDescription rightZignature = right.data(
|
||||
ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
|
||||
switch (left.column()) {
|
||||
case ZignaturesModel::OffsetColumn:
|
||||
@ -156,6 +159,7 @@ void ZignaturesWidget::setScrollMode()
|
||||
|
||||
void ZignaturesWidget::on_zignaturesTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
ZignatureDescription item = index.data(ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
ZignatureDescription item = index.data(
|
||||
ZignaturesModel::ZignatureDescriptionRole).value<ZignatureDescription>();
|
||||
Core()->seek(item.offset);
|
||||
}
|
||||
|
@ -13,9 +13,8 @@ class MainWindow;
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ZignaturesWidget;
|
||||
namespace Ui {
|
||||
class ZignaturesWidget;
|
||||
}
|
||||
|
||||
class ZignaturesModel : public QAbstractListModel
|
||||
|
Loading…
Reference in New Issue
Block a user