This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][DWARF] Update handling of size 1 ranges and fix sub-programs with ranges
ClosedPublic

Authored by ayermolo on Jul 26 2023, 2:50 PM.

Details

Summary

When output range is only one entry, and input is low_pc/high_pc do not convert
to ranges. This helps with size of .debug_ranges/.debug_rnglists. It also helps
when either low_pc/high_pc is 0. We not generating potentially invalid ranges
that result in LLDB error.

Also fixed handling of DW_AT_subprogram with ranges. This can be created with
-fbasic-block-sections=all.

Diff Detail

Event Timeline

ayermolo created this revision.Jul 26 2023, 2:50 PM
Herald added a reviewer: Amir. · View Herald Transcript
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
ayermolo requested review of this revision.Jul 26 2023, 2:50 PM
Herald added a project: Restricted Project. · View Herald Transcript

Thanks for the fix. Please make the title more concise. No need to list all added test cases in the summary.

bolt/lib/Rewrite/DWARFRewriter.cpp
254
702

Add documentation for the function.

817

Do we need to assert here that LowPCVal.getDIEInteger().getValue() == 0?

819

I wonder if the compiler is aggressively splitting, e.g. all exception-handling code, this case will be quite common?

823
ayermolo marked 3 inline comments as done.Jul 28 2023, 2:43 PM
ayermolo added inline comments.
bolt/lib/Rewrite/DWARFRewriter.cpp
254

Didn't realize there was ReallyHidden option. Is there a ReallyReallyRallyLikeForRealItsHidden one? lol

817

Well it might not be actually. Should we just use LowPCVal.getDIEInteger().getValue(), even thought address is wrong?
My thought was is that LLDB can deal with low_pc=0, not sure what it does when address is wrong.

819

no idea. I haven't actually seen this in the wild. Thus a warning, and just putting something that "makes sense".

ayermolo edited the summary of this revision. (Show Details)Jul 28 2023, 2:44 PM
ayermolo retitled this revision from [BOLT][DWARF] Don't convert low_pc/high_pc to ranges for size 1, and fix handling of sub-program with ranges to [BOLT][DWARF] Update how ranges for size 1 are handled, and fix handling of sub-program with ranges.
ayermolo updated this revision to Diff 545290.Jul 28 2023, 3:16 PM
ayermolo marked an inline comment as done.

addressed some of the comments

Pre-merge checks are failing.

ayermolo updated this revision to Diff 545470.Jul 30 2023, 1:13 PM

updated warning check

maksfb accepted this revision.Jul 30 2023, 1:13 PM
This revision is now accepted and ready to land.Jul 30 2023, 1:13 PM
ayermolo retitled this revision from [BOLT][DWARF] Update how ranges for size 1 are handled, and fix handling of sub-program with ranges to [BOLT][DWARF] Update handling of size 1 ranges and fix sub-programs with ranges.Jul 30 2023, 1:15 PM