This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add SectionList::ContainsFileAddressRange
Changes PlannedPublic

Authored by labath on Jul 23 2020, 6:48 AM.

Details

Summary

This is similar to FindSectionContainingFileAddress, except it doesn't
return a section (because that would be ambiguous), and it checks for an
address range instead of a single address.

The idea is to use this for validating line tables (follow-up patch).

Diff Detail

Event Timeline

labath created this revision.Jul 23 2020, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2020, 6:48 AM
Herald added a subscriber: mgorny. · View Herald Transcript
JDevlieghere accepted this revision.Jul 23 2020, 9:20 AM
JDevlieghere added inline comments.
lldb/include/lldb/Core/Section.h
75

addr_t looks a bit weird for the size, but then offset_t also wouldn't make sense. uint64_t maybe? I'll leave it up to you.

This revision is now accepted and ready to land.Jul 23 2020, 9:20 AM
clayborg added inline comments.Jul 23 2020, 2:38 PM
lldb/include/lldb/Core/Section.h
75

Can we use Range<AddrType, SizeType> from RangeMap.h here?

using Range = Range<lldb::addr_t, uint64_t>;
bool ContainsFileAddressRange(Range range) const;
labath planned changes to this revision.Jul 24 2020, 4:45 AM

Waiting for the resolution of the discussion in the follow-up patch.

MaskRay added inline comments.
lldb/source/Core/Section.cpp
570

I am a bit concerned about the potential large time complexity here.FindSectionContainingFileAddress is O(|sections|) and this loop usually executes once but can take a lot of iterations in a pessimistic case. See my comment in D84402.

lldb/unittests/Core/SectionTest.cpp
43

Might be useful leaving a comment that there is a gap.