Adding inline callstack information to disassembly (#468)

* Adding callstack information to disassembly

* changelog

* Cleanup

* Fix snapshots.json

* Clang tidy fixes

* Fix infinite recursion

* Apply suggestions from code review

Co-authored-by: Indic, Vladimir <Vladimir.Indic@amd.com>

* Remove sibling transversal

* Added docstrings

* Apply suggestions from code review

* Update source/include/rocprofiler-sdk/cxx/codeobj/code_printing.hpp

* Review comments

* Format + comments

* Fmt

* Add class name

* Format

* Fix static linkage

* Making funcs inline

---------

Co-authored-by: Giovanni <gbaraldi@amd.com>
Co-authored-by: Indic, Vladimir <Vladimir.Indic@amd.com>
This commit is contained in:
Baraldi, Giovanni
2025-07-22 15:52:42 +02:00
zatwierdzone przez GitHub
rodzic de4708963e
commit be74e1b49f
3 zmienionych plików z 282 dodań i 16 usunięć
+16 -5
Wyświetl plik
@@ -151,13 +151,24 @@ CodeFile::~CodeFile()
jcode.push_back(nlohmann::json::parse(code.str()));
size_t lineref = isa.code_line->comment.rfind(':');
if(lineref == 0 || lineref == std::string::npos) continue;
auto& comment = isa.code_line->comment;
size_t lineref = comment.find(':');
size_t previous = 0;
auto source_ref = isa.code_line->comment.substr(0, lineref);
// size() + 2 because we need at least ':' and one number after
while(lineref != std::string::npos && lineref < comment.size() + 2)
{
auto source_ref = comment.substr(previous, lineref - previous);
if(!source_ref.empty() && snapshots.find(source_ref) == snapshots.end())
snapshots.insert(std::move(source_ref));
if(!source_ref.empty() && snapshots.find(source_ref) == snapshots.end())
snapshots.insert(std::move(source_ref));
previous = comment.find(CodeLine::Instruction::separator, lineref);
if(previous == std::string::npos) break;
previous += CodeLine::Instruction::separator.size();
lineref = comment.find(':', previous);
}
}
nlohmann::json json;