Skip to content

[Symbolize] Always use filename:line from debug info when debug info for the given address is available. #128619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 25, 2025

Conversation

ZequanWu
Copy link
Contributor

@ZequanWu ZequanWu commented Feb 25, 2025

To reland #124846, we need to make symbolizer consistent with the case when line number is 0. Always using filename and line from debug info even if the line number is 0 sounds like the reasonable path to go.

… indicate if debug info is present or not for a given address.
@llvmbot
Copy link
Member

llvmbot commented Feb 25, 2025

@llvm/pr-subscribers-platform-windows
@llvm/pr-subscribers-llvm-binary-utilities

@llvm/pr-subscribers-debuginfo

Author: Zequan Wu (ZequanWu)

Changes

It has two commits:

d76efd8 adds the APIs to DIContext to return std::optional<DILineInfo> to indicate if the debug info for the given address is available.
2ebc27a let symbolizer to always use the filename:line info from debug info when available.


Full diff: https://github.com/llvm/llvm-project/pull/128619.diff

9 Files Affected:

  • (modified) llvm/include/llvm/DebugInfo/BTF/BTFContext.h (+6)
  • (modified) llvm/include/llvm/DebugInfo/DIContext.h (+6)
  • (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h (+6)
  • (modified) llvm/include/llvm/DebugInfo/PDB/PDBContext.h (+6)
  • (modified) llvm/lib/DebugInfo/BTF/BTFContext.cpp (+11)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFContext.cpp (+24-6)
  • (modified) llvm/lib/DebugInfo/PDB/PDBContext.cpp (+11)
  • (modified) llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp (+17-10)
  • (added) llvm/test/tools/llvm-symbolizer/debug-info-line-info.yaml (+175)
diff --git a/llvm/include/llvm/DebugInfo/BTF/BTFContext.h b/llvm/include/llvm/DebugInfo/BTF/BTFContext.h
index c16bee6133220..b9c7cd5ede7bc 100644
--- a/llvm/include/llvm/DebugInfo/BTF/BTFContext.h
+++ b/llvm/include/llvm/DebugInfo/BTF/BTFContext.h
@@ -48,6 +48,12 @@ class BTFContext final : public DIContext {
   std::vector<DILocal>
   getLocalsForAddress(object::SectionedAddress Address) override;
 
+  std::optional<DILineInfo> getOptionalLineInfoForAddress(
+      object::SectionedAddress Address,
+      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
+  std::optional<DILineInfo>
+  getOptionalLineInfoForDataAddress(object::SectionedAddress Address) override;
+
   static std::unique_ptr<BTFContext> create(
       const object::ObjectFile &Obj,
       std::function<void(Error)> ErrorHandler = WithColor::defaultErrorHandler);
diff --git a/llvm/include/llvm/DebugInfo/DIContext.h b/llvm/include/llvm/DebugInfo/DIContext.h
index 71685ba09d8db..d7990092ec8fa 100644
--- a/llvm/include/llvm/DebugInfo/DIContext.h
+++ b/llvm/include/llvm/DebugInfo/DIContext.h
@@ -267,6 +267,12 @@ class DIContext {
   virtual std::vector<DILocal>
   getLocalsForAddress(object::SectionedAddress Address) = 0;
 
+  virtual std::optional<DILineInfo> getOptionalLineInfoForAddress(
+      object::SectionedAddress Address,
+      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
+  virtual std::optional<DILineInfo>
+  getOptionalLineInfoForDataAddress(object::SectionedAddress Address) = 0;
+
 private:
   const DIContextKind Kind;
 };
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
index 0d6e2b076cc34..6ea909480926c 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -401,6 +401,12 @@ class DWARFContext : public DIContext {
   std::vector<DILocal>
   getLocalsForAddress(object::SectionedAddress Address) override;
 
+  std::optional<DILineInfo> getOptionalLineInfoForAddress(
+      object::SectionedAddress Address,
+      DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
+  std::optional<DILineInfo>
+  getOptionalLineInfoForDataAddress(object::SectionedAddress Address) override;
+
   bool isLittleEndian() const { return DObj->isLittleEndian(); }
   static unsigned getMaxSupportedVersion() { return 5; }
   static bool isSupportedVersion(unsigned version) {
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h
index 3163c0a1dae03..1f436a705b072 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBContext.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBContext.h
@@ -57,6 +57,12 @@ namespace pdb {
     std::vector<DILocal>
     getLocalsForAddress(object::SectionedAddress Address) override;
 
+    std::optional<DILineInfo> getOptionalLineInfoForAddress(
+        object::SectionedAddress Address,
+        DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
+    std::optional<DILineInfo> getOptionalLineInfoForDataAddress(
+        object::SectionedAddress Address) override;
+
   private:
     std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
     std::unique_ptr<IPDBSession> Session;
diff --git a/llvm/lib/DebugInfo/BTF/BTFContext.cpp b/llvm/lib/DebugInfo/BTF/BTFContext.cpp
index 2e651cb378dbf..0b172bf8c3fe3 100644
--- a/llvm/lib/DebugInfo/BTF/BTFContext.cpp
+++ b/llvm/lib/DebugInfo/BTF/BTFContext.cpp
@@ -20,6 +20,17 @@ using namespace llvm;
 using object::ObjectFile;
 using object::SectionedAddress;
 
+std::optional<DILineInfo>
+BTFContext::getOptionalLineInfoForAddress(object::SectionedAddress Address,
+                                          DILineInfoSpecifier Specifier) {
+  return getLineInfoForAddress(Address, Specifier);
+}
+
+std::optional<DILineInfo> BTFContext::getOptionalLineInfoForDataAddress(
+    object::SectionedAddress Address) {
+  return getLineInfoForDataAddress(Address);
+}
+
 DILineInfo BTFContext::getLineInfoForAddress(SectionedAddress Address,
                                              DILineInfoSpecifier Specifier) {
   const BTF::BPFLineInfo *LineInfo = BTF.findLineInfo(Address);
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 99e1642ff23ad..a2955cc2a7f55 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -1732,11 +1732,21 @@ DWARFContext::getLocalsForAddress(object::SectionedAddress Address) {
 
 DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address,
                                                DILineInfoSpecifier Spec) {
-  DILineInfo Result;
+  std::optional<DILineInfo> Result =
+      getOptionalLineInfoForAddress(Address, Spec);
+  if (Result)
+    return *Result;
+  return DILineInfo();
+}
+
+std::optional<DILineInfo>
+DWARFContext::getOptionalLineInfoForAddress(object::SectionedAddress Address,
+                                            DILineInfoSpecifier Spec) {
   DWARFCompileUnit *CU = getCompileUnitForCodeAddress(Address.Address);
   if (!CU)
-    return Result;
+    return std::nullopt;
 
+  DILineInfo Result;
   getFunctionNameAndStartLineForAddress(
       CU, Address.Address, Spec.FNKind, Spec.FLIKind, Result.FunctionName,
       Result.StartFileName, Result.StartLine, Result.StartAddress);
@@ -1753,17 +1763,25 @@ DILineInfo DWARFContext::getLineInfoForAddress(object::SectionedAddress Address,
 
 DILineInfo
 DWARFContext::getLineInfoForDataAddress(object::SectionedAddress Address) {
-  DILineInfo Result;
+  std::optional<DILineInfo> Result = getOptionalLineInfoForDataAddress(Address);
+  if (Result)
+    return *Result;
+  return DILineInfo();
+}
+
+std::optional<DILineInfo> DWARFContext::getOptionalLineInfoForDataAddress(
+    object::SectionedAddress Address) {
   DWARFCompileUnit *CU = getCompileUnitForDataAddress(Address.Address);
   if (!CU)
-    return Result;
+    return std::nullopt;
 
   if (DWARFDie Die = CU->getVariableForAddress(Address.Address)) {
+    DILineInfo Result;
     Result.FileName = Die.getDeclFile(FileLineInfoKind::AbsoluteFilePath);
     Result.Line = Die.getDeclLine();
+    return Result;
   }
-
-  return Result;
+  return std::nullopt;
 }
 
 DILineInfoTable DWARFContext::getLineInfoForAddressRange(
diff --git a/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/llvm/lib/DebugInfo/PDB/PDBContext.cpp
index e600fb7385f13..462cb70c95579 100644
--- a/llvm/lib/DebugInfo/PDB/PDBContext.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBContext.cpp
@@ -32,6 +32,17 @@ PDBContext::PDBContext(const COFFObjectFile &Object,
 
 void PDBContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts){}
 
+std::optional<DILineInfo>
+PDBContext::getOptionalLineInfoForAddress(object::SectionedAddress Address,
+                                          DILineInfoSpecifier Specifier) {
+  return getLineInfoForAddress(Address, Specifier);
+}
+
+std::optional<DILineInfo> PDBContext::getOptionalLineInfoForDataAddress(
+    object::SectionedAddress Address) {
+  return getLineInfoForDataAddress(Address);
+}
+
 DILineInfo PDBContext::getLineInfoForAddress(object::SectionedAddress Address,
                                              DILineInfoSpecifier Specifier) {
   DILineInfo Result;
diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index d5e1dc759df5c..69cf992a26842 100644
--- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -276,9 +276,12 @@ SymbolizableObjectFile::symbolizeCode(object::SectionedAddress ModuleOffset,
   if (ModuleOffset.SectionIndex == object::SectionedAddress::UndefSection)
     ModuleOffset.SectionIndex =
         getModuleSectionIndexForAddress(ModuleOffset.Address);
-  DILineInfo LineInfo =
-      DebugInfoContext->getLineInfoForAddress(ModuleOffset, LineInfoSpecifier);
-
+  DILineInfo LineInfo;
+  std::optional<DILineInfo> DBGLineInfo =
+      DebugInfoContext->getOptionalLineInfoForAddress(ModuleOffset,
+                                                      LineInfoSpecifier);
+  if (DBGLineInfo)
+    LineInfo = *DBGLineInfo;
   // Override function name from symbol table if necessary.
   if (shouldOverrideWithSymbolTable(LineInfoSpecifier.FNKind, UseSymbolTable)) {
     std::string FunctionName, FileName;
@@ -287,7 +290,7 @@ SymbolizableObjectFile::symbolizeCode(object::SectionedAddress ModuleOffset,
                                FileName)) {
       LineInfo.FunctionName = FunctionName;
       LineInfo.StartAddress = Start;
-      if (LineInfo.FileName == DILineInfo::BadString && !FileName.empty())
+      if (!DBGLineInfo && !FileName.empty())
         LineInfo.FileName = FileName;
     }
   }
@@ -304,8 +307,11 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
       ModuleOffset, LineInfoSpecifier);
 
   // Make sure there is at least one frame in context.
-  if (InlinedContext.getNumberOfFrames() == 0)
+  bool EmptyFrameAdded = false;
+  if (InlinedContext.getNumberOfFrames() == 0) {
+    EmptyFrameAdded = true;
     InlinedContext.addFrame(DILineInfo());
+  }
 
   // Override the function name in lower frame with name from symbol table.
   if (shouldOverrideWithSymbolTable(LineInfoSpecifier.FNKind, UseSymbolTable)) {
@@ -317,7 +323,7 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
           InlinedContext.getNumberOfFrames() - 1);
       LI->FunctionName = FunctionName;
       LI->StartAddress = Start;
-      if (LI->FileName == DILineInfo::BadString && !FileName.empty())
+      if (EmptyFrameAdded && !FileName.empty())
         LI->FileName = FileName;
     }
   }
@@ -334,10 +340,11 @@ DIGlobal SymbolizableObjectFile::symbolizeData(
   Res.DeclFile = FileName;
 
   // Try and get a better filename:lineno pair from the debuginfo, if present.
-  DILineInfo DL = DebugInfoContext->getLineInfoForDataAddress(ModuleOffset);
-  if (DL.Line != 0) {
-    Res.DeclFile = DL.FileName;
-    Res.DeclLine = DL.Line;
+  std::optional<DILineInfo> DL =
+      DebugInfoContext->getOptionalLineInfoForDataAddress(ModuleOffset);
+  if (DL) {
+    Res.DeclFile = DL->FileName;
+    Res.DeclLine = DL->Line;
   }
   return Res;
 }
diff --git a/llvm/test/tools/llvm-symbolizer/debug-info-line-info.yaml b/llvm/test/tools/llvm-symbolizer/debug-info-line-info.yaml
new file mode 100644
index 0000000000000..94460e586a540
--- /dev/null
+++ b/llvm/test/tools/llvm-symbolizer/debug-info-line-info.yaml
@@ -0,0 +1,175 @@
+# Test llvm-symbolizer always uses line info from debug info if present.
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-symbolizer --obj=%t 0x1 | FileCheck %s
+
+# CHECK:      foo(bool)
+# CHECK-NEXT: ??:0:0
+
+--- !ELF
+FileHeader:
+  Class:           ELFCLASS64
+  Data:            ELFDATA2LSB
+  Type:            ET_REL
+  Machine:         EM_X86_64
+  SectionHeaderStringTable: .strtab
+Sections:
+  - Name:            .text
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
+    AddressAlign:    0x10
+    Content:         50E80000000031C059C3
+  - Name:            .debug_abbrev
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x1
+    Content:         01110025251305032572171017111B12067317000000
+  - Name:            .debug_info
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x1
+    Content:         1E000000050001080000000001002100010000000000000000000A00000000000000
+  - Name:            .debug_str_offsets
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x1
+    Content:         0C000000050000000000000000000000
+  - Name:            .debug_line
+    Type:            SHT_PROGBITS
+    AddressAlign:    0x1
+    Content:         5C0000000500080037000000010101FB0E0D00010101010000000100000101011F010000000003011F020F051E0100000000009C5BB3AA3D0567AB9CB3F5A35C9F9B230400000902000000000000000013061E0505060A5F060B2E0202000101
+  - Name:            .debug_line_str
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_MERGE, SHF_STRINGS ]
+    AddressAlign:    0x1
+    EntSize:         0x1
+    Content:         003C696E76616C69643E00
+  - Name:            .rela.text
+    Type:            SHT_RELA
+    Flags:           [ SHF_INFO_LINK ]
+    Link:            .symtab
+    AddressAlign:    0x8
+    Info:            .text
+    Relocations:
+      - Offset:          0x2
+        Symbol:          _Z3barv
+        Type:            R_X86_64_PLT32
+        Addend:          -4
+  - Name:            .rela.debug_info
+    Type:            SHT_RELA
+    Flags:           [ SHF_INFO_LINK ]
+    Link:            .symtab
+    AddressAlign:    0x8
+    Info:            .debug_info
+    Relocations:
+      - Offset:          0x8
+        Symbol:          .debug_abbrev
+        Type:            R_X86_64_32
+      - Offset:          0x11
+        Symbol:          .debug_str_offsets
+        Type:            R_X86_64_32
+        Addend:          8
+      - Offset:          0x15
+        Symbol:          .debug_line
+        Type:            R_X86_64_32
+      - Offset:          0x1E
+        Symbol:          .debug_addr
+        Type:            R_X86_64_32
+        Addend:          8
+  - Name:            .rela.debug_str_offsets
+    Type:            SHT_RELA
+    Flags:           [ SHF_INFO_LINK ]
+    Link:            .symtab
+    AddressAlign:    0x8
+    Info:            .debug_str_offsets
+    Relocations:
+      - Offset:          0x8
+        Symbol:          .debug_str
+        Type:            R_X86_64_32
+      - Offset:          0xC
+        Symbol:          .debug_str
+        Type:            R_X86_64_32
+        Addend:          24
+  - Name:            .rela.debug_addr
+    Type:            SHT_RELA
+    Flags:           [ SHF_INFO_LINK ]
+    Link:            .symtab
+    AddressAlign:    0x8
+    Info:            .debug_addr
+    Relocations:
+      - Offset:          0x8
+        Symbol:          .text
+        Type:            R_X86_64_64
+  - Name:            .rela.debug_line
+    Type:            SHT_RELA
+    Flags:           [ SHF_INFO_LINK ]
+    Link:            .symtab
+    AddressAlign:    0x8
+    Info:            .debug_line
+    Relocations:
+      - Offset:          0x22
+        Symbol:          .debug_line_str
+        Type:            R_X86_64_32
+      - Offset:          0x2E
+        Symbol:          .debug_line_str
+        Type:            R_X86_64_32
+        Addend:          1
+      - Offset:          0x48
+        Symbol:          .text
+        Type:            R_X86_64_64
+  - Type:            SectionHeaderTable
+    Sections:
+      - Name:            .strtab
+      - Name:            .text
+      - Name:            .rela.text
+      - Name:            .debug_abbrev
+      - Name:            .debug_info
+      - Name:            .rela.debug_info
+      - Name:            .debug_str_offsets
+      - Name:            .rela.debug_str_offsets
+      - Name:            .debug_str
+      - Name:            .debug_addr
+      - Name:            .rela.debug_addr
+      - Name:            .debug_line
+      - Name:            .rela.debug_line
+      - Name:            .debug_line_str
+      - Name:            .symtab
+Symbols:
+  - Name:            main.cpp
+    Type:            STT_FILE
+    Index:           SHN_ABS
+  - Name:            .text
+    Type:            STT_SECTION
+    Section:         .text
+  - Name:            .debug_abbrev
+    Type:            STT_SECTION
+    Section:         .debug_abbrev
+  - Name:            .debug_str_offsets
+    Type:            STT_SECTION
+    Section:         .debug_str_offsets
+  - Name:            .debug_str
+    Type:            STT_SECTION
+    Section:         .debug_str
+  - Name:            .debug_addr
+    Type:            STT_SECTION
+    Section:         .debug_addr
+  - Name:            .debug_line
+    Type:            STT_SECTION
+    Section:         .debug_line
+  - Name:            .debug_line_str
+    Type:            STT_SECTION
+    Section:         .debug_line_str
+  - Name:            _Z3foob
+    Type:            STT_FUNC
+    Section:         .text
+    Binding:         STB_LOCAL
+    Size:            0xA
+  - Name:            _Z3barv
+    Binding:         STB_LOCAL
+DWARF:
+  debug_str:
+    - clang version 21.0.0git
+    - '<invalid>'
+  debug_addr:
+    - Length:          0xC
+      Version:         0x5
+      AddressSize:     0x8
+      Entries:
+        - {}
+...

@dwblaikie
Copy link
Collaborator

Feels a bit awkward to add new virtual functions for this - when, at least I think in theory, the new virtual functions are strictly more expressivse than the old ones (so, one option would be to rename the virtual functions to add the new behavior, then add non-virtual wrapping functions that provide the old behavior under the original name).

But, also - maybe this isn't the level at which to make the change? Perhaps inside the DILine Info, the file/line number should be wrapped in an optional, so it's clear that neither of those things is present/valid?

@rnk
Copy link
Collaborator

rnk commented Feb 25, 2025

Feels a bit awkward to add new virtual functions for this - when, at least I think in theory, the new virtual functions are strictly more expressivse than the old ones (so, one option would be to rename the virtual functions to add the new behavior, then add non-virtual wrapping functions that provide the old behavior under the original name).

But, also - maybe this isn't the level at which to make the change? Perhaps inside the DILine Info, the file/line number should be wrapped in an optional, so it's clear that neither of those things is present/valid?

I share this concern, and I think there is already a lot of prior art for expressing ideas like "source" and "confidence level" inside of the DILineInfo struct. What is the meaning of the IsApproximateLine boolean, for example? We could freely add another boolean there to indicate our confidence, i.e. the presence of a line table. The callers that currently distinguish success by checking for line 0 would migrate to this boolean.

@dwblaikie
Copy link
Collaborator

Feels a bit awkward to add new virtual functions for this - when, at least I think in theory, the new virtual functions are strictly more expressivse than the old ones (so, one option would be to rename the virtual functions to add the new behavior, then add non-virtual wrapping functions that provide the old behavior under the original name).
But, also - maybe this isn't the level at which to make the change? Perhaps inside the DILine Info, the file/line number should be wrapped in an optional, so it's clear that neither of those things is present/valid?

I share this concern, and I think there is already a lot of prior art for expressing ideas like "source" and "confidence level" inside of the DILineInfo struct. What is the meaning of the IsApproximateLine boolean, for example? We could freely add another boolean there to indicate our confidence, i.e. the presence of a line table. The callers that currently distinguish success by checking for line 0 would migrate to this boolean.

Switching to bundle the file/line/column/whatever else (source I guess, because no need to carry source if you don't know which file it is in anyway) optional would require more explicit cleanup, but I'd prefer that (the data structure would be more self descriptive/constrained) than adding an extra boolean.

The IsApproximateLine attribute is for folks who really don't like line zero - it searches backwards in the line table to find the nearest non-zero entry. It can even cross basic block boundaries, if I recall correctly. It could create confusion in stack frames (could lead the line/file/column to be from the caller (or callee) but outside (or inside) a different inlined subroutine range, etc)

@ZequanWu
Copy link
Contributor Author

Feels a bit awkward to add new virtual functions for this - when, at least I think in theory, the new virtual functions are strictly more expressivse than the old ones (so, one option would be to rename the virtual functions to add the new behavior, then add non-virtual wrapping functions that provide the old behavior under the original name).

But, also - maybe this isn't the level at which to make the change? Perhaps inside the DILine Info, the file/line number should be wrapped in an optional, so it's clear that neither of those things is present/valid?

Because there are so many places use those original APIs, making them to return optional requires large scale change. For the same reason, I didn't go the way to make file/line optional.

@dwblaikie
Copy link
Collaborator

Feels a bit awkward to add new virtual functions for this - when, at least I think in theory, the new virtual functions are strictly more expressivse than the old ones (so, one option would be to rename the virtual functions to add the new behavior, then add non-virtual wrapping functions that provide the old behavior under the original name).
But, also - maybe this isn't the level at which to make the change? Perhaps inside the DILine Info, the file/line number should be wrapped in an optional, so it's clear that neither of those things is present/valid?

Because there are so many places use those original APIs, making them to return optional requires large scale change. For the same reason, I didn't go the way to make file/line optional.

We aren't usually trying to optimize for the size of a change, within reason. (doing so tends to lead to a codebase that becomes harder to maintain over time because it lacks a unifying design)

Copy link

github-actions bot commented Mar 19, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@ZequanWu
Copy link
Contributor Author

I looked at our internal failed test again. I was wrong about why our internal test failed. I thought it was because symbolizer chooses the filename from symbol table when the filename from debug info is <invalid>. But it turns out that we don't have any debug info for that address, so the <invalid> comes from the default DILineInfo. So this change seems unrelated. It's not something happens in practice.

Copy link
Contributor Author

@ZequanWu ZequanWu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disregard the above comment. It's actually possible to have <invalid>:0 debug info after #124846. I missed something when reproing internal test failure.

@ZequanWu ZequanWu merged commit 535b284 into llvm:main Mar 25, 2025
9 of 11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/15360

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp # RUN: at line 47
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
#0 0x00007b845fd8ade0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib/libLLVMSupport.so.21.0git+0x1f1de0)
#1 0x00007b845fd881ef llvm::sys::RunSignalHandlers() (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib/libLLVMSupport.so.21.0git+0x1ef1ef)
#2 0x00007b845fd8833a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007b845f442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007b845ff1eae9 llvm::MCAsmBackend::createObjectWriter(llvm::raw_pwrite_stream&) const (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/lib/libLLVMMC.so.21.0git+0x47ae9)
#5 0x0000653c98735b93 main (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llvm-mc+0xab93)
#6 0x00007b845f429d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#7 0x00007b845f429e40 call_init ./csu/../csu/libc-start.c:128:20
#8 0x00007b845f429e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#9 0x0000653c987362d5 _start (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llvm-mc+0xb2d5)
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.script: line 3: 876202 Segmentation fault      (core dumped) /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/14403

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/llvm-mc -filetype=obj /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp # RUN: at line 47
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/llvm-mc -filetype=obj /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:60:39: error: unexpected token in '.loc' directive
        .loc    1 1 0                           # <invalid>:1:0
                                                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:64:8: error: unknown token in expression
        pushq   %rax
                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:64:8: error: invalid operand
        pushq   %rax
                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:66:7: error: unknown token in expression
        movl    %edi, %eax
                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:66:7: error: invalid operand
        movl    %edi, %eax
                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:69:39: error: unexpected token in '.loc' directive
        .loc    1 1 1 prologue_end              # <invalid>:1:1
                                                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:70:10: error: unknown token in expression
        orl     $2, %eax
                    ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:70:10: error: invalid operand
        orl     $2, %eax
                    ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:71:11: error: unknown token in expression
        subl    $7, %eax
                    ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:71:11: error: invalid operand
        subl    $7, %eax
                    ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:72:2: error: unrecognized instruction mnemonic
        je      .LBB0_1
        ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:73:2: error: unrecognized instruction mnemonic, did you mean: cmp?
        jmp     .LBB0_2
        ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:77:39: error: unexpected token in '.loc' directive
        .loc    1 0 0 is_stmt 0                 # <invalid>:0
                                                ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:78:2: error: unrecognized instruction mnemonic
        callq   bar
        ^
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:82:39: error: unexpected token in '.loc' directive
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/15357

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp # RUN: at line 47
+ /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
#0 0x00007106f3fb5de0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib/libLLVMSupport.so.21.0git+0x1f1de0)
#1 0x00007106f3fb31ef llvm::sys::RunSignalHandlers() (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib/libLLVMSupport.so.21.0git+0x1ef1ef)
#2 0x00007106f3fb333a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007106f3642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007106f4149ae9 llvm::MCAsmBackend::createObjectWriter(llvm::raw_pwrite_stream&) const (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/lib/libLLVMMC.so.21.0git+0x47ae9)
#5 0x000059e2655b5b83 main (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llvm-mc+0xab83)
#6 0x00007106f3629d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#7 0x00007106f3629e40 call_init ./csu/../csu/libc-start.c:128:20
#8 0x00007106f3629e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#9 0x000059e2655b62c5 _start (/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llvm-mc+0xb2c5)
/home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.script: line 3: 1055559 Segmentation fault      (core dumped) /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/bin/llvm-mc -filetype=obj /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/buildbot/worker/as-builder-7/ramdisk/llvm-nvptx-nvidia-ubuntu/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/13950

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llvm-mc -filetype=obj /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp # RUN: at line 47
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llvm-mc -filetype=obj /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:56:12: error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>' or "<type>"
        .type   foo,@function
                    ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:60:39: error: unexpected token in '.loc' directive
        .loc    1 1 0                           # <invalid>:1:0
                                                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:64:8: error: unexpected token in operand
        pushq   %rax
                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:66:7: error: unexpected token in operand
        movl    %edi, %eax
                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:69:39: error: unexpected token in '.loc' directive
        .loc    1 1 1 prologue_end              # <invalid>:1:1
                                                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:70:10: error: unexpected token in operand
        orl     $2, %eax
                    ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:71:11: error: unexpected token in operand
        subl    $7, %eax
                    ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:72:2: error: invalid instruction
        je      .LBB0_1
        ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:73:2: error: invalid instruction, did you mean: cmp?
        jmp     .LBB0_2
        ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:77:39: error: unexpected token in '.loc' directive
        .loc    1 0 0 is_stmt 0                 # <invalid>:0
                                                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:78:2: error: invalid instruction
        callq   bar
        ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:82:39: error: unexpected token in '.loc' directive
        .loc    1 6 1 epilogue_begin is_stmt 1  # <invalid>:6:1
                                                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:83:7: error: unexpected token in operand
        popq    %rax
                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:85:38: error: unexpected token in argument list
        jmp     bar                             # TAILCALL
                                                ^
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:91:28: error: expected '%<type>' or "<type>"
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-5 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/17098

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc -filetype=obj /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /Users/buildbot/buildbot-root/aarch64-darwin/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp # RUN: at line 47
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc -filetype=obj /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /Users/buildbot/buildbot-root/aarch64-darwin/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:56:2: error: unknown directive
        .type   foo,@function
        ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:60:39: error: unexpected token in '.loc' directive
        .loc    1 1 0                           # <invalid>:1:0
                                                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:64:8: error: unknown token in expression
        pushq   %rax
                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:64:8: error: invalid operand
        pushq   %rax
                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:66:7: error: unknown token in expression
        movl    %edi, %eax
                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:66:7: error: invalid operand
        movl    %edi, %eax
                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:69:39: error: unexpected token in '.loc' directive
        .loc    1 1 1 prologue_end              # <invalid>:1:1
                                                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:70:10: error: unknown token in expression
        orl     $2, %eax
                    ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:70:10: error: invalid operand
        orl     $2, %eax
                    ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:71:11: error: unknown token in expression
        subl    $7, %eax
                    ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:71:11: error: invalid operand
        subl    $7, %eax
                    ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:72:2: error: unrecognized instruction mnemonic
        je      .LBB0_1
        ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:73:2: error: unrecognized instruction mnemonic, did you mean: cmp?
        jmp     .LBB0_2
        ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:77:39: error: unexpected token in '.loc' directive
        .loc    1 0 0 is_stmt 0                 # <invalid>:0
                                                ^
/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s:78:2: error: unrecognized instruction mnemonic
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/54/builds/7672

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 3221225477

Command Output (stdout):
--
# RUN: at line 47
c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llvm-mc.exe -filetype=obj C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\tools\llvm-symbolizer\use-debug-info-line-info.s -o C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\test\tools\llvm-symbolizer\Output\use-debug-info-line-info.s.tmp
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llvm-mc.exe' -filetype=obj 'C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\tools\llvm-symbolizer\use-debug-info-line-info.s' -o 'C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\test\tools\llvm-symbolizer\Output\use-debug-info-line-info.s.tmp'
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
# | Stack dump:
# | 0.	Program arguments: c:\\buildbot\\as-builder-8\\llvm-nvptx-nvidia-win\\build\\bin\\llvm-mc.exe -filetype=obj C:\\buildbot\\as-builder-8\\llvm-nvptx-nvidia-win\\llvm-project\\llvm\\test\\tools\\llvm-symbolizer\\use-debug-info-line-info.s -o C:\\buildbot\\as-builder-8\\llvm-nvptx-nvidia-win\\build\\test\\tools\\llvm-symbolizer\\Output\\use-debug-info-line-info.s.tmp
# | Exception Code: 0xC0000005
# | #0 0x00007ff704b5b223 (c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llvm-mc.exe+0xeb223)
# | #1 0x00007ff704a7b944 (c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llvm-mc.exe+0xb944)
# | #2 0x00007ff704c84c80 (c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llvm-mc.exe+0x214c80)
# | #3 0x00007ffb82d07ac4 (C:\Windows\System32\KERNEL32.DLL+0x17ac4)
# | #4 0x00007ffb83fca8c1 (C:\Windows\SYSTEM32\ntdll.dll+0x5a8c1)
# `-----------------------------
# error: command failed with exit status: 0xc0000005

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 25, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/155/builds/7838

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 3221225477

Command Output (stdout):
--
# RUN: at line 47
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe -filetype=obj C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\tools\llvm-symbolizer\use-debug-info-line-info.s -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\tools\llvm-symbolizer\Output\use-debug-info-line-info.s.tmp
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe' -filetype=obj 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\tools\llvm-symbolizer\use-debug-info-line-info.s' -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\tools\llvm-symbolizer\Output\use-debug-info-line-info.s.tmp'
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
# | Stack dump:
# | 0.	Program arguments: c:\\buildbot\\as-builder-8\\llvm-nvptx64-nvidia-win\\build\\bin\\llvm-mc.exe -filetype=obj C:\\buildbot\\as-builder-8\\llvm-nvptx64-nvidia-win\\llvm-project\\llvm\\test\\tools\\llvm-symbolizer\\use-debug-info-line-info.s -o C:\\buildbot\\as-builder-8\\llvm-nvptx64-nvidia-win\\build\\test\\tools\\llvm-symbolizer\\Output\\use-debug-info-line-info.s.tmp
# | Exception Code: 0xC0000005
# | #0 0x00007ff61b6bb223 (c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe+0xeb223)
# | #1 0x00007ff61b5db944 (c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe+0xb944)
# | #2 0x00007ff61b7e4c90 (c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe+0x214c90)
# | #3 0x00007ffb82d07ac4 (C:\Windows\System32\KERNEL32.DLL+0x17ac4)
# | #4 0x00007ffb83fca8c1 (C:\Windows\SYSTEM32\ntdll.dll+0x5a8c1)
# `-----------------------------
# error: command failed with exit status: 0xc0000005

--

********************


@dyung
Copy link
Collaborator

dyung commented Mar 25, 2025

@ZequanWu the test tools/llvm-symbolizer/use-debug-info-line-info.s seems to be failing on multiple build bots. Can you fix it or revert if you need time to investigate to get the bots back to green?

ZequanWu added a commit that referenced this pull request Mar 25, 2025
@ZequanWu
Copy link
Contributor Author

@ZequanWu the test tools/llvm-symbolizer/use-debug-info-line-info.s seems to be failing on multiple build bots. Can you fix it or revert if you need time to investigate to get the bots back to green?

Hope this will fix it.

@dyung
Copy link
Collaborator

dyung commented Mar 25, 2025

@ZequanWu the test tools/llvm-symbolizer/use-debug-info-line-info.s seems to be failing on multiple build bots. Can you fix it or revert if you need time to investigate to get the bots back to green?

Hope this will fix it.

I believe you need a REQUIRES line if you are going to reference a specific target

https://lab.llvm.org/buildbot/#/builders/190/builds/17106

******************** TEST 'LLVM :: tools/llvm-symbolizer/use-debug-info-line-info.s' FAILED ********************
Exit Code: 1
Command Output (stderr):
--
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc --filetype=obj --triple x86_64-pc-linux /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /Users/buildbot/buildbot-root/aarch64-darwin/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp # RUN: at line 47
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc --filetype=obj --triple x86_64-pc-linux /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/tools/llvm-symbolizer/use-debug-info-line-info.s -o /Users/buildbot/buildbot-root/aarch64-darwin/build/test/tools/llvm-symbolizer/Output/use-debug-info-line-info.s.tmp
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux', see --version and --triple.
--
********************

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Mar 25, 2025
ZequanWu added a commit that referenced this pull request Mar 25, 2025
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Mar 25, 2025
ZequanWu added a commit to ZequanWu/llvm-project that referenced this pull request Mar 31, 2025
…24846)"

This land commits 23aca2f and 1b15a89. llvm#128619 makes symbolizer to always use debug info when available so we can reland this chagnge.
ZequanWu added a commit that referenced this pull request Mar 31, 2025
…" (#133798)

This land commits 23aca2f and
1b15a89.
#128619 makes symbolizer to
always use debug info when available so we can reland this chagnge.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Mar 31, 2025
…ble (#124846)" (#133798)

This land commits 23aca2f and
1b15a89.
llvm/llvm-project#128619 makes symbolizer to
always use debug info when available so we can reland this chagnge.
ZequanWu added a commit that referenced this pull request Apr 10, 2025
…#124846)" (#133798)"

This reverts commit 3483740 because #128619 doesn't handle the case when we have an empty frame from `getInliningInfoForAddress` because line num is 0 which makes it non-differentiable from missing debug info. So, we end up using the base filename from symtab again. Reverting for now until that issus is solved.
AllinLeeYL pushed a commit to AllinLeeYL/llvm-project that referenced this pull request Apr 10, 2025
…llvm#124846)" (llvm#133798)"

This reverts commit 3483740 because llvm#128619 doesn't handle the case when we have an empty frame from `getInliningInfoForAddress` because line num is 0 which makes it non-differentiable from missing debug info. So, we end up using the base filename from symtab again. Reverting for now until that issus is solved.
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
…llvm#124846)" (llvm#133798)"

This reverts commit 3483740 because llvm#128619 doesn't handle the case when we have an empty frame from `getInliningInfoForAddress` because line num is 0 which makes it non-differentiable from missing debug info. So, we end up using the base filename from symtab again. Reverting for now until that issus is solved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants