This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Verify that sibling and children fall in parent range.
AbandonedPublic

Authored by JDevlieghere on Sep 5 2017, 8:24 AM.

Details

Summary

I was recently looking at a binary where a TAG_subprogram didn't fall in its parent range. The dwarfdump that ships with Darwin was able to detect this, while LLVM's version didn't. This patch adds this verification.

I'm looking on input how best to test this. It seems to be currently tested in the unit tests with YAML input. I I have an object file of a minimal example, generated with an old compiler. However, just the DWARF corresponds to about 700 lines of YAML, which I'm afraid is not really appropriate for a unit tests.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Sep 5 2017, 8:24 AM
JDevlieghere edited the summary of this revision. (Show Details)Sep 5 2017, 8:27 AM
JDevlieghere added a reviewer: clayborg.
JDevlieghere added subscribers: llvm-commits, sgravani.
@dblaikie wrote:

Might be worth looking at the previous review on this: https://reviews.llvm.org/D32821

(yeah, it stalled out - partly my fault, I did go back to try to work up the changes I'd been suggesting, but hit some other issues that I gave up on - might be worth discussing design first a bit before diving into the code changes)

I imagine a test for this could be reduced beyond 700 lines of YAML - happy to help with that if you get stuck/have trouble reducing/simplifying it.

(I mean there's several things to test for here, but one basic one should be well reduced to ~10s of lines, hopefully)

Thanks David, that looks very similar indeed! The truth is that I don't really have an idea how to get started on reducing a YAML test case without breaking everything. I've given it a try but the result wasn't valid anymore, even before changing the ranges.

clayborg edited edge metadata.Sep 5 2017, 10:09 AM

I tend to use the DWARF generator to create a super minimal DWARF file, then obj2yaml that. It tends to be really short and ok for adding as a test. The DWARF generator only exists in the gtest for the DWARF, but you can add a new gtest, generate the DWARF, then remove the gtest.

JDevlieghere abandoned this revision.Sep 11 2017, 8:47 AM

Abandoning in favor of D37696