This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] UnwindTable::create() should not add empty rows to CFI unwind table
ClosedPublic

Authored by RamNalamothu on May 5 2021, 4:06 AM.

Details

Summary

UnwindTable::parseRows() may return successfully if the CFIProgram has either
no CFI instructions or only DW_CFA_nop instructions and the UnwindRow return
argument will be empty. But currently, the callers are not checking for this case
which is leading to incorrect dumps in the unwind tables in such cases i.e.

CFA=unspecified

Diff Detail

Event Timeline

RamNalamothu created this revision.May 5 2021, 4:06 AM
RamNalamothu requested review of this revision.May 5 2021, 4:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2021, 4:06 AM
RamNalamothu edited the summary of this revision. (Show Details)May 5 2021, 4:45 AM

Greg,

I found this case while working on https://reviews.llvm.org/D76877.

BTW, would appreciate if you could take a look at https://reviews.llvm.org/D76877 and https://reviews.llvm.org/D76878. Feel free to add others if they would be interested as well.

clayborg accepted this revision.May 5 2021, 11:25 AM

LGTM! Just had one nit code edit suggestion.

llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
234–242

We can return early if we check if empty first to avoid a function call here.

This revision is now accepted and ready to land.May 5 2021, 11:25 AM

Made the suggested code changes.

RamNalamothu marked an inline comment as done.May 5 2021, 4:08 PM

Thank you.

Does this look good now for commit?

Handle the scenario when the CIE or FDE has only DW_CFA_nop instructions.

RamNalamothu edited the summary of this revision. (Show Details)May 6 2021, 7:58 AM
clayborg accepted this revision.May 7 2021, 11:08 AM

Yes, lgtm!