[llvm] Added --report=debugger option to llvm-debuginfo-analyzer (PR #159853)

Carlos Alberto Enciso via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 08:38:47 PDT 2025


================
@@ -516,13 +517,185 @@ Error LVReader::doPrint() {
     if (options().getReportParents() || options().getReportView())
       if (Error Err = printScopes())
         return Err;
-
+    // Requested debugger report.
+    if (options().getReportDebugger())
+      if (Error Err = printDebugger())
+        return Err;
     return Error::success();
   }
 
   return printScopes();
 }
 
+namespace {
+
+struct DebuggerViewPrinter {
+  std::vector<const LVLine *> Lines;
+  std::unordered_map<LVAddress, std::vector<const LVLocation *>> LifetimeBegins;
+  std::unordered_map<LVAddress, std::vector<const LVLocation *>>
+      LifetimeEndsExclusive;
+  raw_ostream &OS;
+
+  const bool IncludeRanges = false;
+
+  void walk(raw_ostream &OS, const LVScope *Scope) {
+    if (Scope->scopeCount()) {
+      for (const LVScope *ChildScope : *Scope->getScopes())
+        walk(OS, ChildScope);
+    }
+    if (Scope->lineCount()) {
+      for (const LVLine *Line : *Scope->getLines()) {
+        Lines.push_back(Line);
+      }
+    }
+    if (Scope->symbolCount()) {
+      for (const LVSymbol *Symbol : *Scope->getSymbols()) {
+        LVLocations SymbolLocations;
+        Symbol->getLocations(SymbolLocations);
+        if (SymbolLocations.empty())
+          continue;
+
+        if (IncludeRanges)
+          OS << "{Range}: " << Symbol->getName() << " (line "
+             << Symbol->getLineNumber() << ")" << ": ";
+
+        for (const LVLocation *Loc : SymbolLocations) {
+          if (Loc->getIsGapEntry())
----------------
CarlosAlbertoEnciso wrote:

`Loc`  --> `Location`

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


More information about the llvm-commits mailing list