diff options
| author | inspectredc <inspectredc@gmail.com> | 2026-02-12 14:49:32 +0000 |
|---|---|---|
| committer | Lywx <kiritodev01@gmail.com> | 2026-02-17 22:43:42 -0600 |
| commit | aeb3a52f5ff934794ca88e7be739e7a753db4ff6 (patch) | |
| tree | 0db0d080ae78bb67b38ff9db9ce0fe68d6f45133 /src/Companion.cpp | |
| parent | 8989568a03882f81e030b68a854d7cc6acbe74fa (diff) | |
Fix get parse data by addr and symbol to actually allow for external files
Diffstat (limited to 'src/Companion.cpp')
| -rw-r--r-- | src/Companion.cpp | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/src/Companion.cpp b/src/Companion.cpp index 911e18e..6f9db6c 100644 --- a/src/Companion.cpp +++ b/src/Companion.cpp @@ -1621,46 +1621,58 @@ std::string Companion::GetSymbolFromAddr(uint32_t address, bool validZero) { } std::optional<ParseResultData> Companion::GetParseDataByAddr(uint32_t addr) { - if(!Torch::contains(this->gParseResults, this->gCurrentFile)){ - for (auto &file : this->gCurrentExternalFiles) { - if (!Torch::contains(this->gParseResults, file)) { - SPDLOG_INFO("GetParseDataByAddr: External File {} Not Found.", file); - continue; - } - - for (auto& result : this->gParseResults[file]){ - if (result.data.has_value() && result.GetOffset() == addr){ - return result; - } + if (this->gParseResults.contains(this->gCurrentFile)) { + for (auto& result : this->gParseResults[this->gCurrentFile]) { + if (result.data.has_value() && result.GetOffset() == addr) { + return result; } } - return std::nullopt; } - for(auto& result : this->gParseResults[this->gCurrentFile]){ - if(result.data.has_value() && result.GetOffset() == addr){ - return result; + for (auto &file : this->gCurrentExternalFiles) { + if (!this->gParseResults.contains(file)) { + SPDLOG_INFO("GetParseDataByAddr: External File {} Not Found.", file); + continue; + } + + for (auto& result : this->gParseResults[file]) { + if (result.data.has_value() && result.GetOffset() == addr) { + return result; + } } } return std::nullopt; } + std::optional<ParseResultData> Companion::GetParseDataBySymbol(const std::string& symbol) { - if(!Torch::contains(this->gParseResults, this->gCurrentFile)){ - return std::nullopt; + if (this->gParseResults.contains(this->gCurrentFile)) { + for (auto& result : this->gParseResults[this->gCurrentFile]) { + auto sym = GetNode<std::string>(result.node, "symbol"); + + if (result.data.has_value() && sym.has_value() && sym.value() == symbol) { + return result; + } + } } - for(auto& result : this->gParseResults[this->gCurrentFile]){ - auto sym = GetNode<std::string>(result.node, "symbol"); + for (auto &file : this->gCurrentExternalFiles) { + if (!this->gParseResults.contains(file)) { + SPDLOG_INFO("GetParseDataBySymbol: External File {} Not Found.", file); + continue; + } + + for (auto& result : this->gParseResults[file]) { + auto sym = GetNode<std::string>(result.node, "symbol"); - if(result.data.has_value() && sym.has_value() && sym.value() == symbol){ - return result; + if (result.data.has_value() && sym.has_value() && sym.value() == symbol) { + return result; + } } } return std::nullopt; - } std::optional<std::vector<std::tuple<std::string, YAML::Node>>> Companion::GetNodesByType(const std::string& type){ |
