From 62c972333a9d0e0ea6aa19b217b01aa09daa53cd Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 7 Apr 2025 19:01:10 +0200 Subject: [PATCH] Support ignoring multiple functions --- src/analyzer/main.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/analyzer/main.cpp b/src/analyzer/main.cpp index 671017b3..7e002334 100644 --- a/src/analyzer/main.cpp +++ b/src/analyzer/main.cpp @@ -26,6 +26,32 @@ namespace std::unordered_map path_mappings{}; }; + void split_and_insert(std::set>& container, const std::string_view str, + const char splitter = ',') + { + size_t current_start = 0; + for (size_t i = 0; i < str.size(); ++i) + { + const auto value = str[i]; + if (value != splitter) + { + continue; + } + + if (current_start < i) + { + container.emplace(str.substr(current_start, i - current_start)); + } + + current_start = i + 1; + } + + if (current_start < str.size()) + { + container.emplace(str.substr(current_start)); + } + } + void watch_system_objects(windows_emulator& win_emu, const std::set>& modules, const bool cache_logging) { @@ -359,10 +385,10 @@ namespace { if (args.size() < 2) { - throw std::runtime_error("No ignored function provided after -i"); + throw std::runtime_error("No ignored function(s) provided after -i"); } arg_it = args.erase(arg_it); - options.ignored_functions.emplace(args[0]); + split_and_insert(options.ignored_functions, args[0]); } else if (arg == "-p") {