[PATCH] D46583: DWARFVerifier: Check "completeness" of .debug_names section

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 08:22:42 PDT 2018


labath created this revision.
labath added reviewers: JDevlieghere, aprantl, dblaikie.

This patch implements a check which makes sure all entries required by
the DWARF v5 specification are present in the Name Index. The algorithm
tries to follow the wording of Section 6.1.1.1 of the spec as closely as
possible.

The main deviation from it is that instead of a whitelist-based approach
in the spec "The name index must contain an entry for each debugging
information entry that defines a named subprogram, label, variable,
type, or namespace" I chose a blacklist-based one, where I consider
everything to be "in" and then remove the entries that don't make sense.
I did this because it has more potential for catching interesting cases
and the above is a bit vague (it uses plain words like "variable" and
"subprogram", but the rest of the section speaks about specific TAGs).

This approach has raised some interesting questions, the main one being
whether enumerator values should be indexed. The consensus seems to be
that they should, although it does not follow from section 6.1.1.1.
For the time being I made the verifier ignore these, as LLVM does not do
this yet, and I wanted to get a clean run when verifying generated debug
info.

Another interesting case was the DW_TAG_imported_declaration. It was not
immediately clear to me whether this should go in or not, but currently
it is not indexed, and (unlike the enumerators) in does not seem to cause
problems for LLDB, so I've also ignored it.


Repository:
  rL LLVM

https://reviews.llvm.org/D46583

Files:
  include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
  include/llvm/DebugInfo/DWARF/DWARFVerifier.h
  lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
  lib/DebugInfo/DWARF/DWARFVerifier.cpp
  test/tools/llvm-dwarfdump/X86/debug-names-verify-completeness.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46583.145693.patch
Type: text/x-patch
Size: 20599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180508/83e287e0/attachment.bin>


More information about the llvm-commits mailing list