Page MenuHomePhabricator

[libunwind] Bare-metal DWARF: set dso_base to 0
ClosedPublic

Authored by rprichard on Aug 27 2020, 4:22 PM.

Details

Summary

Previously, DwarfFDECache::findFDE used 0 as a special value meaning
"search the entire cache, including dynamically-registered FDEs".
Switch this special value to -1, which doesn't make sense as a DSO
base.

Fixes PR47335.

Diff Detail

Event Timeline

rprichard created this revision.Aug 27 2020, 4:22 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 27 2020, 4:22 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
rprichard requested review of this revision.Aug 27 2020, 4:22 PM

Looks overall reasonable to me, but it's been years since I touched that code or used an environment involving it, so someone else would have to sign off on it.

Why not use -1 as the indicator instead of 0?

Why not use -1 as the indicator instead of 0?

Just to be sure, the proposal is to use 0 for dso_base and -1 for DwarfFDECache::findFDE to mean "search everything"?

I think that will work, because -1 seems unlikely to appear as a genuine dso_base.

rprichard updated this revision to Diff 290630.Sep 8 2020, 8:40 PM

Use -1 to indicate "search all cache entries".

compnerd accepted this revision.Sep 9 2020, 10:01 AM

Yes, sorry I wasn't clear about that, but you understood correctly. I was suggesting using -1 as the search all, since it doesn't make sense as a DSO base. Minor comment about a possible constexpr improvement, but doesn't require a re-review.

libunwind/src/UnwindCursor.hpp
84

I wonder if we can get away with constexpr in addition to const.

This revision is now accepted and ready to land.Sep 9 2020, 10:01 AM
rprichard added inline comments.Sep 9 2020, 3:34 PM
libunwind/src/UnwindCursor.hpp
84

constexpr should work -- libunwind doesn't use it yet, but it uses other C++11 features (e.g. https://reviews.llvm.org/D86411#2233300). I'll switch it from const to constexpr, which also implies const for a variable.

rprichard edited the summary of this revision. (Show Details)Sep 9 2020, 3:38 PM
This revision was landed with ongoing or failed builds.Sep 9 2020, 3:43 PM
This revision was automatically updated to reflect the committed changes.