refactor: update.
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
CompileFlags:
|
||||
Add: ["-std:latest", "/clang:-std=c++23"]
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace di::data_format {
|
||||
|
||||
class BoundSymbolList : public IOBase {
|
||||
class BoundSymbolList : public io::IOBase {
|
||||
public:
|
||||
using for_each_callback_t = std::function<void(BoundSymbol const&)>;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace di::data_format {
|
||||
|
||||
class MagicBlob : public StreamedIO {
|
||||
class MagicBlob : public io::StreamedIO {
|
||||
public:
|
||||
using for_each_callback_t = std::function<void(hash_t, MagicEntry const&)>;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace di::data_format {
|
||||
|
||||
class RawText : public IOBase {
|
||||
class RawText : public io::IOBase {
|
||||
public:
|
||||
void read(const fs::path& path) override;
|
||||
void write(const fs::path& path) const override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace di::data_format {
|
||||
|
||||
class TypedSymbolList : public IOBase {
|
||||
class TypedSymbolList : public io::IOBase {
|
||||
public:
|
||||
using for_each_callback_t = std::function<void(TypedSymbol const&)>;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace di {
|
||||
namespace di::io {
|
||||
|
||||
class IOBase {
|
||||
public:
|
||||
@@ -10,4 +10,4 @@ public:
|
||||
virtual void write(const fs::path& path) const = 0;
|
||||
};
|
||||
|
||||
} // namespace di
|
||||
} // namespace di::io
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "io/streamed_io.h"
|
||||
|
||||
namespace di {
|
||||
namespace di::io {
|
||||
|
||||
void StreamedIO::read(const fs::path& path) {
|
||||
m_file_stream.open(path, std::ios::binary);
|
||||
@@ -14,4 +14,4 @@ void StreamedIO::write(const fs::path& path) const {
|
||||
ofs << m_file_stream.rdbuf();
|
||||
}
|
||||
|
||||
} // namespace di
|
||||
} // namespace di::io
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#include "io/io_base.h"
|
||||
|
||||
namespace di {
|
||||
namespace di::io {
|
||||
|
||||
class StreamedIO : public IOBase {
|
||||
class StreamedIO : public io::IOBase {
|
||||
public:
|
||||
void read(const fs::path& path) override;
|
||||
void write(const fs::path& path) const override;
|
||||
@@ -40,4 +40,4 @@ private:
|
||||
std::ifstream m_file_stream;
|
||||
};
|
||||
|
||||
} // namespace di
|
||||
} // namespace di::io
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace {
|
||||
// http://stackoverflow.com/questions/4948780
|
||||
|
||||
template <class T>
|
||||
inline void hash_combine(std::size_t& seed, T const& v) {
|
||||
constexpr void hash_combine(std::size_t& seed, T const& v) {
|
||||
seed ^= std::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace di::object_file {
|
||||
|
||||
class PDB : public IOBase {
|
||||
class PDB : public io::IOBase {
|
||||
public:
|
||||
using owning_coff_t = std::unique_ptr<COFF>;
|
||||
using owning_symbol_data_t = std::unique_ptr<data_format::BoundSymbolList>;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#endif
|
||||
|
||||
using namespace di;
|
||||
using namespace di::data_format;
|
||||
|
||||
[[nodiscard]] auto load_args(int argc, char* argv[]) {
|
||||
argparse::ArgumentParser program("askrva");
|
||||
@@ -66,13 +67,13 @@ using namespace di;
|
||||
int main(int argc, char* argv[]) try {
|
||||
|
||||
auto args = load_args(argc, argv);
|
||||
auto symlist = data_format::TypedSymbolList();
|
||||
auto symlist = TypedSymbolList();
|
||||
|
||||
data_format::BoundSymbolList bound_symbol_list;
|
||||
data_format::RawText failed_list;
|
||||
BoundSymbolList bound_symbol_list;
|
||||
RawText failed_list;
|
||||
|
||||
#if !DI_USE_NATIVE_SYMBOL_RESOLVER
|
||||
data_format::MagicBlob magic_blob;
|
||||
MagicBlob magic_blob;
|
||||
magic_blob.read(args.m_magic_blob_path);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using namespace di;
|
||||
using namespace di::data_format;
|
||||
|
||||
auto load_args(int argc, char* argv[]) {
|
||||
argparse::ArgumentParser program("blob-extractor");
|
||||
@@ -36,7 +37,7 @@ int main(int argc, char* argv[]) try {
|
||||
|
||||
auto args = load_args(argc, argv);
|
||||
|
||||
data_format::MagicBlob blob;
|
||||
MagicBlob blob;
|
||||
blob.read(args.m_magic_blob_path);
|
||||
|
||||
nlohmann::json data;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
using namespace di;
|
||||
using namespace di::object_file;
|
||||
using namespace di::data_format;
|
||||
|
||||
auto load_args(int argc, char* argv[]) {
|
||||
argparse::ArgumentParser program("extractpdb");
|
||||
@@ -42,7 +43,7 @@ int main(int argc, char* argv[]) try {
|
||||
PDB pdb;
|
||||
pdb.read(args.m_program_database_path);
|
||||
|
||||
data_format::TypedSymbolList symbol_list;
|
||||
TypedSymbolList symbol_list;
|
||||
|
||||
pdb.for_each<PDB::Public>([&symbol_list](const codeview::PublicSym32& symbol
|
||||
) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "data_format/bound_symbol_list.h"
|
||||
|
||||
using namespace di;
|
||||
using namespace di::data_format;
|
||||
|
||||
[[nodiscard]] auto load_args(int argc, char* argv[]) {
|
||||
|
||||
@@ -54,7 +55,7 @@ int main(int argc, char* argv[]) try {
|
||||
auto server_program =
|
||||
std::make_unique<object_file::COFF>(args.server_program_path);
|
||||
|
||||
auto symbol_data = std::make_unique<data_format::BoundSymbolList>();
|
||||
auto symbol_data = std::make_unique<BoundSymbolList>();
|
||||
symbol_data->read(args.symbol_data_path);
|
||||
|
||||
object_file::PDB pdb;
|
||||
|
||||
@@ -3,7 +3,6 @@ add_rules('mode.debug', 'mode.release')
|
||||
add_requires('argparse 3.1')
|
||||
add_requires('nlohmann_json 3.11.3')
|
||||
add_requires('xxhash 0.8.3')
|
||||
add_requires('boost 1.87.0')
|
||||
|
||||
add_requires('llvm')
|
||||
|
||||
@@ -30,13 +29,13 @@ end
|
||||
|
||||
--- global settings
|
||||
|
||||
set_policy("build.optimization.lto", true)
|
||||
|
||||
set_languages('c23', 'c++23')
|
||||
set_warnings('all')
|
||||
|
||||
add_includedirs('src')
|
||||
|
||||
set_policy("build.optimization.lto", true)
|
||||
|
||||
if is_mode('debug') then
|
||||
add_defines('DI_DEBUG')
|
||||
end
|
||||
@@ -100,6 +99,7 @@ target('extractsym')
|
||||
|
||||
add_packages(
|
||||
'llvm',
|
||||
'nlohmann_json',
|
||||
'argparse'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user