1
0
Fork 0

Fix formatting

This commit is contained in:
Duncan Ogilvie 2025-01-25 03:38:11 +01:00
parent fd7209c8b7
commit 1cd2684eb5
6 changed files with 103 additions and 101 deletions

View File

@ -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> <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>
<setting name="Ignore" serializeAs="String"> <setting name="Ignore" serializeAs="String">
<value /> <value>src/cross/vendor</value>
</setting> </setting>
<setting name="License" serializeAs="String"> <setting name="License" serializeAs="String">
<value /> <value />

View File

@ -119,7 +119,7 @@ struct DmpFileParser : FileParser
thread = &mDmp.GetThreads().begin()->second; thread = &mDmp.GetThreads().begin()->second;
} }
bool disasm64 = false; bool disasm64 = false;
std::visit([&](auto&& arg) std::visit([&](auto && arg)
{ {
using T = std::decay_t<decltype(arg)>; using T = std::decay_t<decltype(arg)>;
if constexpr(std::is_same_v<T, udmpparser::Context64_t>) 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> MemoryRegions() const override
{ {
std::vector<MemoryRegion> regions; std::vector<MemoryRegion> regions;
const auto& mem = mDmp.GetMem(); const auto & mem = mDmp.GetMem();
for(const auto& itr : mem) for(const auto & itr : mem)
{ {
regions.emplace_back(); regions.emplace_back();
MemoryRegion& region = regions.back(); MemoryRegion & region = regions.back();
const udmpparser::MemBlock_t & block = itr.second; const udmpparser::MemBlock_t & block = itr.second;
region.BaseAddress = block.BaseAddress; region.BaseAddress = block.BaseAddress;
region.RegionSize = block.RegionSize; region.RegionSize = block.RegionSize;
@ -197,7 +197,7 @@ struct PeFileParser : FileParser, MemoryProvider
uint64_t mEntryPoint = 0; uint64_t mEntryPoint = 0;
std::vector<Section> mSections; 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; mBegin = begin;
mEnd = end; mEnd = end;
@ -246,7 +246,7 @@ struct PeFileParser : FileParser, MemoryProvider
// Align the sections // Align the sections
for(uint32_t i = 0; i < pnth->file_header.num_sections; i++) 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; std::string name;
for(auto ch : section.name.short_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> MemoryRegions() const override
{ {
std::vector<MemoryRegion> regions; std::vector<MemoryRegion> regions;
for(const auto& section : mSections) for(const auto & section : mSections)
{ {
regions.emplace_back(); regions.emplace_back();
MemoryRegion& region = regions.back(); MemoryRegion & region = regions.back();
region.BaseAddress = section.addr; region.BaseAddress = section.addr;
region.RegionSize = section.size; region.RegionSize = section.size;
region.State = StateToStringShort(MEM_COMMIT); region.State = StateToStringShort(MEM_COMMIT);
@ -355,7 +355,7 @@ struct PeFileParser : FileParser, MemoryProvider
bool read(duint addr, void* dest, duint size) override bool read(duint addr, void* dest, duint size) override
{ {
for(const auto& section : mSections) for(const auto & section : mSections)
{ {
// TODO: support reading across sections // TODO: support reading across sections
if(addr >= section.addr && addr + size <= section.addr + section.size) 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 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) if(addr >= section.addr && addr < section.addr + section.size)
{ {
@ -397,7 +397,7 @@ struct PeFileParser : FileParser, MemoryProvider
bool isCodePtr(duint addr) override bool isCodePtr(duint addr) override
{ {
for(const auto& section : mSections) for(const auto & section : mSections)
{ {
if(addr >= section.addr && addr < section.addr + section.size) if(addr >= section.addr && addr < section.addr + section.size)
{ {
@ -409,7 +409,7 @@ struct PeFileParser : FileParser, MemoryProvider
bool isValidPtr(duint addr) override bool isValidPtr(duint addr) override
{ {
for(const auto& section : mSections) for(const auto & section : mSections)
{ {
if(addr >= section.addr && addr < section.addr + section.size) 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) // Invalidate the global memory provider (TODO: localize everything)
DbgSetMemoryProvider(nullptr); DbgSetMemoryProvider(nullptr);

View File

@ -20,7 +20,7 @@ struct MemoryRegion
struct FileParser 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 ~FileParser() = default;
virtual bool disasm64() = 0; virtual bool disasm64() = 0;

View File

@ -52,7 +52,8 @@ RemoteTable::RemoteTable(QWidget* parent)
uint64_t minTime = UINT64_MAX; uint64_t minTime = UINT64_MAX;
uint64_t maxTime = 0; uint64_t maxTime = 0;
dsint totalDelta = 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(); uint64_t timeMs = std::chrono::duration_cast<std::chrono::milliseconds>(time.time_since_epoch()).count();
minTime = std::min(minTime, timeMs); minTime = std::min(minTime, timeMs);
maxTime = std::max(maxTime, timeMs); maxTime = std::max(maxTime, timeMs);

View File

@ -6,7 +6,7 @@
#include "Configuration.h" #include "Configuration.h"
#include "btparser/types.h" #include "btparser/types.h"
StructWidget::StructWidget(QWidget *parent) StructWidget::StructWidget(QWidget* parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::StructWidget) , ui(new Ui::StructWidget)
{ {
@ -36,7 +36,7 @@ void StructWidget::on_pushButtonParse_clicked()
if(!manager.ParseTypes(declaration, "StructWidget", errors)) if(!manager.ParseTypes(declaration, "StructWidget", errors))
{ {
QString message = "Parsing failed:"; QString message = "Parsing failed:";
for(const auto& error : errors) for(const auto & error : errors)
{ {
message += "\n"; message += "\n";
message += QString::fromStdString(error); message += QString::fromStdString(error);

View File

@ -3,8 +3,9 @@
#include <QWidget> #include <QWidget>
namespace Ui { namespace Ui
class StructWidget; {
class StructWidget;
} }
class StructWidget : public QWidget class StructWidget : public QWidget
@ -12,7 +13,7 @@ class StructWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit StructWidget(QWidget *parent = nullptr); explicit StructWidget(QWidget* parent = nullptr);
~StructWidget(); ~StructWidget();
private slots: private slots:
@ -21,7 +22,7 @@ private slots:
void on_plainTextEditDeclaration_textChanged(); void on_plainTextEditDeclaration_textChanged();
private: private:
Ui::StructWidget *ui; Ui::StructWidget* ui;
}; };
#endif // STRUCTWIDGET_H #endif // STRUCTWIDGET_H