[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data (PR #165163)

via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 2 04:07:16 PST 2025


================
@@ -302,14 +302,38 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
 std::vector<std::string>
 VariableAnnotator::annotate(Instruction &inst, Target &target,
                             const lldb::ModuleSP &module_sp) {
+  auto structured_annotations = annotateStructured(inst, target, module_sp);
+
   std::vector<std::string> events;
+  events.reserve(structured_annotations.size());
+
+  for (const auto &annotation : structured_annotations) {
+    std::string display_string;
+    display_string =
+        llvm::formatv(
+            "{0} = {1}", annotation.variable_name,
+            annotation.location_description == VariableAnnotator::kUndefLocation
+                ? llvm::formatv("<{0}>", VariableAnnotator::kUndefLocation)
+                      .str()
+                : annotation.location_description)
+            .str();
+    events.push_back(display_string);
+  }
+
+  return events;
+}
+
+std::vector<VariableAnnotation>
+VariableAnnotator::annotateStructured(Instruction &inst, Target &target,
----------------
n2h9 wrote:

Thanks Copilot, updated :white_check_mark: .

Also updated existing `annotate` method to be `Annotate` to follow the `LLDB's UpperCamelCase naming convention for methods` :hugs: .

https://github.com/llvm/llvm-project/pull/165163


More information about the lldb-commits mailing list