feat: Exposed demangling of symbols to CLI
This commit is contained in:
parent
b58463bbaf
commit
b5df20d7c6
@ -18,6 +18,7 @@ namespace hex::plugin::builtin {
|
||||
void handleMagicCommand(const std::vector<std::string> &args);
|
||||
void handlePatternLanguageCommand(const std::vector<std::string> &args);
|
||||
void handleHexdumpCommand(const std::vector<std::string> &args);
|
||||
void handleDemangleCommand(const std::vector<std::string> &args);
|
||||
|
||||
|
||||
void registerCommandForwarders();
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include <wolv/math_eval/math_evaluator.hpp>
|
||||
|
||||
#include <pl/cli/cli.hpp>
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
using namespace hex::literals;
|
||||
|
||||
void handleVersionCommand(const std::vector<std::string> &args) {
|
||||
@ -302,6 +302,15 @@ namespace hex::plugin::builtin {
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void handleDemangleCommand(const std::vector<std::string> &args) {
|
||||
if (args.size() != 1) {
|
||||
log::println("usage: imhex --demangle <identifier>");
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
log::println("{}", llvm::demangle(args[0]));
|
||||
}
|
||||
|
||||
|
||||
void registerCommandForwarders() {
|
||||
hex::subcommands::registerSubCommand("open", [](const std::vector<std::string> &args){
|
||||
|
@ -214,7 +214,7 @@ namespace hex::plugin::builtin {
|
||||
};
|
||||
|
||||
std::vector<std::string> splitConversionCommandInput(const std::string &input) {
|
||||
std::vector<std::string> parts = wolv::util::splitString(input, " ");
|
||||
std::vector<std::string> parts = wolv::util::splitString(input, " ", true);
|
||||
std::erase_if(parts, [](auto &part) { return part.empty(); });
|
||||
|
||||
return parts;
|
||||
|
@ -69,6 +69,7 @@ IMHEX_PLUGIN_SUBCOMMANDS() {
|
||||
{ "magic", "Identify file types", hex::plugin::builtin::handleMagicCommand },
|
||||
{ "pl", "Interact with the pattern language", hex::plugin::builtin::handlePatternLanguageCommand },
|
||||
{ "hexdump", "Generate a hex dump of the provided file", hex::plugin::builtin::handleHexdumpCommand },
|
||||
{ "hexdump", "Demangle a mangled symbol", hex::plugin::builtin::handleDemangleCommand },
|
||||
};
|
||||
|
||||
IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user