Fix formatting
This commit is contained in:
parent
fd7209c8b7
commit
1cd2684eb5
|
@ -15,7 +15,7 @@
|
|||
<value>style=allman, convert-tabs, align-pointer=type, align-reference=middle, indent=spaces, indent-namespaces, indent-col1-comments, pad-oper, unpad-paren, keep-one-line-blocks, close-templates</value>
|
||||
</setting>
|
||||
<setting name="Ignore" serializeAs="String">
|
||||
<value />
|
||||
<value>src/cross/vendor</value>
|
||||
</setting>
|
||||
<setting name="License" serializeAs="String">
|
||||
<value />
|
||||
|
|
|
@ -119,7 +119,7 @@ struct DmpFileParser : FileParser
|
|||
thread = &mDmp.GetThreads().begin()->second;
|
||||
}
|
||||
bool disasm64 = false;
|
||||
std::visit([&](auto&& arg)
|
||||
std::visit([&](auto && arg)
|
||||
{
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr(std::is_same_v<T, udmpparser::Context64_t>)
|
||||
|
@ -139,11 +139,11 @@ struct DmpFileParser : FileParser
|
|||
std::vector<MemoryRegion> MemoryRegions() const override
|
||||
{
|
||||
std::vector<MemoryRegion> regions;
|
||||
const auto& mem = mDmp.GetMem();
|
||||
for(const auto& itr : mem)
|
||||
const auto & mem = mDmp.GetMem();
|
||||
for(const auto & itr : mem)
|
||||
{
|
||||
regions.emplace_back();
|
||||
MemoryRegion& region = regions.back();
|
||||
MemoryRegion & region = regions.back();
|
||||
const udmpparser::MemBlock_t & block = itr.second;
|
||||
region.BaseAddress = block.BaseAddress;
|
||||
region.RegionSize = block.RegionSize;
|
||||
|
@ -197,7 +197,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
uint64_t mEntryPoint = 0;
|
||||
std::vector<Section> mSections;
|
||||
|
||||
bool Parse(const uint8_t* begin, const uint8_t* end, std::string& error)
|
||||
bool Parse(const uint8_t* begin, const uint8_t* end, std::string & error)
|
||||
{
|
||||
mBegin = begin;
|
||||
mEnd = end;
|
||||
|
@ -246,7 +246,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
// Align the sections
|
||||
for(uint32_t i = 0; i < pnth->file_header.num_sections; i++)
|
||||
{
|
||||
const auto& section = *pnth->get_section(i);
|
||||
const auto & section = *pnth->get_section(i);
|
||||
|
||||
std::string name;
|
||||
for(auto ch : section.name.short_name)
|
||||
|
@ -332,10 +332,10 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
std::vector<MemoryRegion> MemoryRegions() const override
|
||||
{
|
||||
std::vector<MemoryRegion> regions;
|
||||
for(const auto& section : mSections)
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
regions.emplace_back();
|
||||
MemoryRegion& region = regions.back();
|
||||
MemoryRegion & region = regions.back();
|
||||
region.BaseAddress = section.addr;
|
||||
region.RegionSize = section.size;
|
||||
region.State = StateToStringShort(MEM_COMMIT);
|
||||
|
@ -355,7 +355,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
|
||||
bool read(duint addr, void* dest, duint size) override
|
||||
{
|
||||
for(const auto& section : mSections)
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
// TODO: support reading across sections
|
||||
if(addr >= section.addr && addr + size <= section.addr + section.size)
|
||||
|
@ -383,7 +383,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
|
||||
bool getRange(duint addr, duint & base, duint & size) override
|
||||
{
|
||||
for(const auto& section : mSections)
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
if(addr >= section.addr && addr < section.addr + section.size)
|
||||
{
|
||||
|
@ -397,7 +397,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
|
||||
bool isCodePtr(duint addr) override
|
||||
{
|
||||
for(const auto& section : mSections)
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
if(addr >= section.addr && addr < section.addr + section.size)
|
||||
{
|
||||
|
@ -409,7 +409,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
|
||||
bool isValidPtr(duint addr) override
|
||||
{
|
||||
for(const auto& section : mSections)
|
||||
for(const auto & section : mSections)
|
||||
{
|
||||
if(addr >= section.addr && addr < section.addr + section.size)
|
||||
{
|
||||
|
@ -420,7 +420,7 @@ struct PeFileParser : FileParser, MemoryProvider
|
|||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<FileParser> FileParser::Create(const uint8_t* begin, const uint8_t* end, std::string& error)
|
||||
std::unique_ptr<FileParser> FileParser::Create(const uint8_t* begin, const uint8_t* end, std::string & error)
|
||||
{
|
||||
// Invalidate the global memory provider (TODO: localize everything)
|
||||
DbgSetMemoryProvider(nullptr);
|
||||
|
|
|
@ -20,7 +20,7 @@ struct MemoryRegion
|
|||
|
||||
struct FileParser
|
||||
{
|
||||
static std::unique_ptr<FileParser> Create(const uint8_t* begin, const uint8_t* end, std::string& error);
|
||||
static std::unique_ptr<FileParser> Create(const uint8_t* begin, const uint8_t* end, std::string & error);
|
||||
|
||||
virtual ~FileParser() = default;
|
||||
virtual bool disasm64() = 0;
|
||||
|
|
|
@ -52,7 +52,8 @@ RemoteTable::RemoteTable(QWidget* parent)
|
|||
uint64_t minTime = UINT64_MAX;
|
||||
uint64_t maxTime = 0;
|
||||
dsint totalDelta = 0;
|
||||
for(const auto&[time,delta] : mScrollEvents) {
|
||||
for(const auto&[time, delta] : mScrollEvents)
|
||||
{
|
||||
uint64_t timeMs = std::chrono::duration_cast<std::chrono::milliseconds>(time.time_since_epoch()).count();
|
||||
minTime = std::min(minTime, timeMs);
|
||||
maxTime = std::max(maxTime, timeMs);
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "StructWidget.h"
|
||||
#include "ui_StructWidget.h"
|
||||
#include "Configuration.h"
|
||||
#include "btparser/types.h"
|
||||
|
||||
StructWidget::StructWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::StructWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->plainTextEditDeclaration->setFont(Config()->monospaceFont());
|
||||
ui->plainTextEditMessages->setFont(Config()->monospaceFont());
|
||||
|
||||
QSettings settings;
|
||||
auto declaration = settings.value("StructWidgetDeclaration").toString();
|
||||
ui->plainTextEditDeclaration->setPlainText(declaration);
|
||||
auto endCursor = ui->plainTextEditDeclaration->textCursor();
|
||||
endCursor.movePosition(QTextCursor::End);
|
||||
ui->plainTextEditDeclaration->setTextCursor(endCursor);
|
||||
}
|
||||
|
||||
StructWidget::~StructWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void StructWidget::on_pushButtonParse_clicked()
|
||||
{
|
||||
auto declaration = ui->plainTextEditDeclaration->toPlainText().toStdString();
|
||||
std::vector<std::string> errors;
|
||||
Types::TypeManager manager(8);
|
||||
ui->plainTextEditMessages->clear();
|
||||
if(!manager.ParseTypes(declaration, "StructWidget", errors))
|
||||
{
|
||||
QString message = "Parsing failed:";
|
||||
for(const auto& error : errors)
|
||||
{
|
||||
message += "\n";
|
||||
message += QString::fromStdString(error);
|
||||
}
|
||||
ui->plainTextEditMessages->setPlainText(message);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->plainTextEditMessages->setPlainText("Parsed successfully!");
|
||||
}
|
||||
|
||||
|
||||
void StructWidget::on_plainTextEditDeclaration_textChanged()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("StructWidgetDeclaration", ui->plainTextEditDeclaration->toPlainText());
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "StructWidget.h"
|
||||
#include "ui_StructWidget.h"
|
||||
#include "Configuration.h"
|
||||
#include "btparser/types.h"
|
||||
|
||||
StructWidget::StructWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::StructWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->plainTextEditDeclaration->setFont(Config()->monospaceFont());
|
||||
ui->plainTextEditMessages->setFont(Config()->monospaceFont());
|
||||
|
||||
QSettings settings;
|
||||
auto declaration = settings.value("StructWidgetDeclaration").toString();
|
||||
ui->plainTextEditDeclaration->setPlainText(declaration);
|
||||
auto endCursor = ui->plainTextEditDeclaration->textCursor();
|
||||
endCursor.movePosition(QTextCursor::End);
|
||||
ui->plainTextEditDeclaration->setTextCursor(endCursor);
|
||||
}
|
||||
|
||||
StructWidget::~StructWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void StructWidget::on_pushButtonParse_clicked()
|
||||
{
|
||||
auto declaration = ui->plainTextEditDeclaration->toPlainText().toStdString();
|
||||
std::vector<std::string> errors;
|
||||
Types::TypeManager manager(8);
|
||||
ui->plainTextEditMessages->clear();
|
||||
if(!manager.ParseTypes(declaration, "StructWidget", errors))
|
||||
{
|
||||
QString message = "Parsing failed:";
|
||||
for(const auto & error : errors)
|
||||
{
|
||||
message += "\n";
|
||||
message += QString::fromStdString(error);
|
||||
}
|
||||
ui->plainTextEditMessages->setPlainText(message);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->plainTextEditMessages->setPlainText("Parsed successfully!");
|
||||
}
|
||||
|
||||
|
||||
void StructWidget::on_plainTextEditDeclaration_textChanged()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("StructWidgetDeclaration", ui->plainTextEditDeclaration->toPlainText());
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
#ifndef STRUCTWIDGET_H
|
||||
#define STRUCTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class StructWidget;
|
||||
}
|
||||
|
||||
class StructWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StructWidget(QWidget *parent = nullptr);
|
||||
~StructWidget();
|
||||
|
||||
private slots:
|
||||
void on_pushButtonParse_clicked();
|
||||
|
||||
void on_plainTextEditDeclaration_textChanged();
|
||||
|
||||
private:
|
||||
Ui::StructWidget *ui;
|
||||
};
|
||||
|
||||
#endif // STRUCTWIDGET_H
|
||||
#ifndef STRUCTWIDGET_H
|
||||
#define STRUCTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class StructWidget;
|
||||
}
|
||||
|
||||
class StructWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StructWidget(QWidget* parent = nullptr);
|
||||
~StructWidget();
|
||||
|
||||
private slots:
|
||||
void on_pushButtonParse_clicked();
|
||||
|
||||
void on_plainTextEditDeclaration_textChanged();
|
||||
|
||||
private:
|
||||
Ui::StructWidget* ui;
|
||||
};
|
||||
|
||||
#endif // STRUCTWIDGET_H
|
||||
|
|
Loading…
Reference in New Issue