[PATCH] D32821: Add DWARF verifiers to verify address ranges are correct and scoped correctly.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 13:32:43 PDT 2017


clayborg added a comment.

In https://reviews.llvm.org/D32821#745213, @dblaikie wrote:

> I haven't followed some of the design direction Adrian's been pointing this work in - so all of this is subject to discussion, etc:
>
> 1. I'd expect not to build an entire representation of all ranges up-front, then verify them (uses more memory, etc) - but rather verify during a traversal of the DIEs instead


The whole reason we need this is to look for overlapping functions between all CUs. This helps us to identify exactly which DIEs overlap. It is also just a DIE (2 pointers) + vector<pair<uint64_t, uint64_t>. Not too costly.

> 2. for/for loops to check if one range is a subset of another's probably rather inefficient. Not sure if LLVM already has better tools for this, though I suspect not.

It currently works and I have seen many errors introduced by the compilers when they optimize debug info and they get it wrong. We only check blocks and inline functions against the containing ranges. We can make sure the ranges are coalesced when needed, but other than that, what is innefficient about what is there? 99% of the time it is one range seeing if one other range is contained.

> 
> 
> 3. I'm not sure that function ranges need to be special/separate - I'd expect any nested ranges (eg: the range of two scopes in a function) to be distinct as well, so I'd expect a more general algorithm that walks nodes and their children looking for ranges and checking that children are subsets of parents, and children are distinct from each other.

Again, not sure what is wrong with the way it is doing it. We just keep a stack >= depth of the current DIE with ranges filled in. If a block or inlined function is found, it verifies it is in the parent. The DWARF doesn't store this information in any useful way we can access, so I believe this approach work well.


https://reviews.llvm.org/D32821





More information about the llvm-commits mailing list