This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Relax some checking in the debug line parser
AbandonedPublic

Authored by jhenderson on Dec 19 2019, 6:24 AM.

Details

Summary

The debug line parser was being overly conservative in its checking in some areas. This change removes some checks, and modifies the parser to attempt to recover from more situations where something looks wrong. In cases where a length doesn't match what has been read, parsing is now resumed from the later position (i.e. std::max(OldOffset + Length, CurrentOffset)).

This patch also improves some related testing to make it easier to see what the test is doing.

Diff Detail

Event Timeline

jhenderson created this revision.Dec 19 2019, 6:24 AM
Herald added a project: Restricted Project. · View Herald Transcript

It looks like lld/test/ELF/undef.s comes here by accident, right?

It looks like lld/test/ELF/undef.s comes here by accident, right?

Nope, it's intentional. Beacuse I've relaxed the severity of prologue errors so that the parsing can continue, LLD test no longer fails to load the line information for the undefined reference that has a slightly dodgy line table. For reference, I added the --implicit-check-not to make sure I hadn't missed anything when verifying that test still achieved its main goal. Given that LLD should only emit the bad line table information once, I think it's a worthwhile addition too.

Seems like a lot of changes that could probably be split out into independent patches that'd be easier to review/validate tests, etc?

Some of this includes comments to existing codepaths, for instance - they should proabbly go in separately.

& I'm guessing each change to a recoverable error can probably be committed and tested independently?

Seems like a lot of changes that could probably be split out into independent patches that'd be easier to review/validate tests, etc?

Some of this includes comments to existing codepaths, for instance - they should proabbly go in separately.

& I'm guessing each change to a recoverable error can probably be committed and tested independently?

Yes, you're probably right. I'll take a look at splitting things up more. This is my last day in the office before the New Year. I might get some patches done, but the whole series will likely not be finished until I'm back.

I've put up a series of patches that addresses most of the patch issues that I've fixed with this patch, starting from D71752. I'll continue adding to it as I get time today, and in the New Year, if I don't finish before I leave the office.

jhenderson abandoned this revision.Jan 3 2020, 7:44 AM

I've created a whole series of patches to replace this, some of which have already landed. The remainder are D72154, D72155, D72156, D72157, D72158, and D72159.