[PATCH] D156446: [BPF] Avoid crashing on missing callee DI

Tamir Duberstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 19:09:59 PDT 2023


tamird updated this revision to Diff 544998.
tamird added a comment.

Revert back to better error


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156446/new/

https://reviews.llvm.org/D156446

Files:
  llvm/lib/Target/BPF/BTFDebug.cpp


Index: llvm/lib/Target/BPF/BTFDebug.cpp
===================================================================
--- llvm/lib/Target/BPF/BTFDebug.cpp
+++ llvm/lib/Target/BPF/BTFDebug.cpp
@@ -1372,7 +1372,16 @@
     // This instruction will be skipped, no LineInfo has
     // been generated, construct one based on function signature.
     if (LineInfoGenerated == false) {
-      auto *S = MI->getMF()->getFunction().getSubprogram();
+      const Function &F = MI->getMF()->getFunction();
+      auto *S = F.getSubprogram();
+      if (!S) {
+        std::string Str;
+        {
+          raw_string_ostream OS(Str);
+          OS << "call to subprogram '" << F.getName() << "' without line info";
+        }
+        report_fatal_error(Str.c_str());
+      }
       MCSymbol *FuncLabel = Asm->getFunctionBegin();
       constructLineInfo(S->getFile(), FuncLabel, S->getLine(), 0);
       LineInfoGenerated = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156446.544998.patch
Type: text/x-patch
Size: 912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230728/d2071720/attachment.bin>


More information about the llvm-commits mailing list