diff --git a/src/data_format/type/decl_type.h b/src/data_format/type/decl_type.h index 65a2088..4939c2d 100644 --- a/src/data_format/type/decl_type.h +++ b/src/data_format/type/decl_type.h @@ -43,32 +43,12 @@ public: constexpr Enum data() const { return m_data; } constexpr std::string string() const { - using namespace util::string; - - // clang-format off - - switch (m_data) { - #define HSTR(x) \ - case x: \ - return #x; - HSTR(Function); - HSTR(CXXDeductionGuide); - HSTR(CXXMethod); - HSTR(CXXConstructor); - HSTR(CXXConversion); - HSTR(CXXDestructor); - HSTR(Var); - HSTR(Decomposition); - HSTR(ImplicitParam); - HSTR(OMPCapturedExpr); - HSTR(ParamVar); - HSTR(VarTemplateSpecialization); - #undef HSTR - default: + auto value = magic_enum::enum_name(m_data); + if (value.empty()) { throw EnumCastException(m_data); } - // clang-format on + return std::string(value); } constexpr bool operator==(const DeclType& other) const { diff --git a/xmake.lua b/xmake.lua index 79e0b7d..da96582 100644 --- a/xmake.lua +++ b/xmake.lua @@ -27,11 +27,21 @@ option('symbol-resolver') if option:value() == 'native' and not is_plat('windows') then raise('the native symbol resolver does not support this platform.') end + + -- TODO: remove it. + -- The native symbol resolver is completely unavailable, + -- v1.12.0 Problem: RVA not subtracted from ImageBase. + -- v1.13.0 Problem: pl_resolve_symbol does not return the real function address, and needs to handle thunk. + if option:value() == 'native' then + raise('sorry use builtin symbol resolver please.') + end end) option_end() if is_config('symbol-resolver', 'native') then - add_repositories("liteldev-free-repo https://github.com/liteldev-free/xmake-repo.git") + add_repositories('liteldev-free-repo https://github.com/liteldev-free/xmake-repo.git') + + -- TODO: need to add an option to select the PreLoader version. add_requires('preloader 1.13.0') end @@ -64,6 +74,7 @@ target('libdi') 'boost', 'nlohmann_json', 'openssl3', + 'magic_enum', {public = true} ) @@ -100,10 +111,7 @@ target('askrva') set_pcxxheader('src/pch.h') add_deps('libdi') - add_packages( - 'argparse', - 'magic_enum' - ) + add_packages('argparse') if is_config('symbol-resolver', 'native') then add_packages('preloader') @@ -118,8 +126,7 @@ target('blob-extractor') add_deps('libdi') add_packages( 'argparse', - 'nlohmann_json', - 'magic_enum' + 'nlohmann_json' ) target('dumpsym')