This is an archive of the discontinued LLVM Phabricator instance.

Fix libcxx formatters for changes in r300140.
ClosedPublic

Authored by lhames on Apr 26 2017, 12:58 PM.

Details

Summary

LLVM r300140 changed the layout and field names of __compressed_pair, which
broke LLDB's std::vector, std::map and std::unsorted_map formatters.

This patch attempts to fix these formatters by having them interogate the
__compressed_pair values to determine whether they're pre- or post-r300140
variants, then access them accordingly.

Event Timeline

lhames created this revision.Apr 26 2017, 12:58 PM
EricWF edited edge metadata.Apr 26 2017, 2:00 PM

LLVM r300140 changed the layout and field names of __compressed_pair,

I sure hope it doesn't break the ABI layout of __compressed_pair.

LLVM r300140 changed the layout and field names of __compressed_pair,

I sure hope it doesn't break the ABI layout of __compressed_pair.

Sorry - that was a poorly chosen phrase. I don't believe it changes the binary representation, just the conceptual layout of the class (from a pair of fields to a descendent of two singletons), which changes how it's represented in DWARF.

just making sure I didn't make a mistake.

jingham accepted this revision.Apr 26 2017, 4:33 PM

That looks good. I'm not quite sure why the std::map formatter makes statics for the ConstStrings it's going to use, but the other two look them up each time. I can't imagine it will matter IRL which one you use, and you didn't change the oddity, so...

This revision is now accepted and ready to land.Apr 26 2017, 4:33 PM
lhames closed this revision.Apr 26 2017, 4:42 PM

That looks good. I'm not quite sure why the std::map formatter makes statics for the ConstStrings it's going to use, but the other two look them up each time. I can't imagine it will matter IRL which one you use, and you didn't change the oddity, so...

Yeah - I stuck as close as possible to the existing functions here. I'll clean up the oddities in a separate patch. :)