[PATCH] D129392: llvm-dwarfdump: Don't crash if DW_AT_{decl,call}_{file,line} uses signed form

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 15:53:44 PDT 2022


clayborg added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDie.cpp:139-149
+    if (const auto *LT = U->getContext().getLineTableForUnit(U)) {
+      if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) {
+        if (LT->getFileNameByIndex(
+                *Val, U->getCompilationDir(),
+                DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
+                File)) {
+          File = '"' + File + '"';
----------------
dblaikie wrote:
> I /think/ LLVM's style guide now doesn't encourage omitting braces from single statement but multi-line blocks like this, so I left these ones in.
Do we want to dump the attribute as a number if we can't get the lint table of the value as unsigned here? What happens when we dump a DW_AT_decl_file or DW_AT_call_file that has a signed integer encoding? Nothing comes out? Seems like we should do a "FormValue.dump(OS, DumpOpts);" if either the lit table or optional uint64_t fail to get extracted


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:707-708
   }
+  case DW_AT_call_line:
+  case DW_AT_decl_line: {
+    if (!AttrValue.Value.getAsUnsignedConstant()) {
----------------
Do we want to handle DW_AT_decl_column and DW_AT_call_column here as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129392



More information about the llvm-commits mailing list