[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data: introduce VariableAnnotator::AnnotateStructured method (PR #169408)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 3 17:25:12 PST 2025
================
@@ -387,24 +439,24 @@ std::vector<std::string> VariableAnnotator::Annotate(Instruction &inst) {
auto it = m_live_vars.find(KV.first);
if (it == m_live_vars.end()) {
// Newly live.
- events.emplace_back(
- llvm::formatv("{0} = {1}", KV.second.name, KV.second.last_loc).str());
- } else if (it->second.last_loc != KV.second.last_loc) {
+ AddVariableAnnotationToVector(annotations, KV.second, true);
+ } else if (it->second.location_description !=
+ KV.second.location_description) {
// Location changed.
- events.emplace_back(
- llvm::formatv("{0} = {1}", KV.second.name, KV.second.last_loc).str());
+ AddVariableAnnotationToVector(annotations, KV.second, true);
}
}
- // 2) Ends: anything that was live but is not in current_vars becomes <undef>.
- for (const auto &KV : m_live_vars) {
- if (!current_vars.count(KV.first))
- events.emplace_back(llvm::formatv("{0} = <undef>", KV.second.name).str());
- }
+ // 2) Ends: anything that was live but is not in current_vars becomes
+ // UndefLocation.
+ for (const auto &KV : m_live_vars)
+ if (!current_vars.count(KV.first)) {
+ AddVariableAnnotationToVector(annotations, KV.second, false);
+ }
----------------
JDevlieghere wrote:
```suggestion
if (!current_vars.count(KV.first))
AddVariableAnnotationToVector(annotations, KV.second, false);
```
https://github.com/llvm/llvm-project/pull/169408
More information about the lldb-commits
mailing list