[PATCH] D147202: [dwarfdump] Fix .debug_line verification for DWARF 5

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 00:47:49 PDT 2023


jhenderson added inline comments.
Herald added a subscriber: ormris.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:934
                 << "][" << RowIndex << "] has invalid file index " << Row.File
                 << " (valid values are [" << (isDWARF5 ? "0," : "1,")
                 << LineTable->Prologue.FileNames.size()
----------------
Could we tie the valid values here to the values used to initialise FileIndex somehow, so that we only do this check once?
Example:
```
uint32_t MinFileIndex = isDWARF5 ? 0 : 1;
uint32_t FileIndex = MinFileIndex;
...
<< " (valid values are [" << MinFileIndex
```


================
Comment at: llvm/test/tools/llvm-dwarfdump/X86/verify_dwarf5_debug_line.s:1
+# RUN: llvm-mc %s -filetype obj -triple arm64-apple-macosx -o %t.out
+# RUN: llvm-dwarfdump --verbose -verify %t.out | FileCheck %s
----------------
I'm not too familiar with the DWARF verifier, but does it require the full debug information? The reason I'm asking is because this file has a lot of stuff in it that is completely unrelated to the thing under test, and it would be nice to simplify it somehow (could the yaml2obj DWARF support be used, for example, if we only need the .debug_line section?).

One idea, other than using yaml2obj, that I had was to use llvm-mc's debug data generation, so you'd only need an instruction or two and then use `llvm-mc -g` to generate the debug data. Caveat: I don't know much about how this works and whether you can generate the kind of data you need for this test.


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

https://reviews.llvm.org/D147202



More information about the llvm-commits mailing list