Page MenuHomePhabricator

Miscellaneous fixes for big-endian systems
ClosedPublic

Authored by uweigand on Apr 11 2016, 11:45 AM.

Details

Summary

This patch fixes a bunch of issues that show up on big-endian systems:

  • The gnu_libstdcpp.py script doesn't follow the way libstdc++ encodes bit vectors: it should identify the enclosing *word* and then access the appropriate bit within that word. Instead, the script simply operates on bytes. This gives the same result on little-endian systems, but not on big-endian.
  • lldb_private::formatters::WCharSummaryProvider always assumes wchar_t is UTF16, even though it could also be UTF8 or UTF32. This is mostly not an issue on little-endian systems, but immediately fails on BE. Fixed by checking the size of wchar_t like WCharStringSummaryProvider already does.
  • ClangASTContext::GetChildCompilerTypeAtIndex uses uint32_t to access the virtual base offset stored in the vtable, even though the size of this field matches the target pointer size according to the C++ ABI. Again, this is mostly not visible on LE, but fails on BE.
  • Process::ReadStringFromMemory uses strncmp to search for a terminator consisting of multiple zero bytes. This doesn't work since strncmp will stop already at the first zero byte. Use memcmp instead.

Diff Detail

Repository
rL LLVM

Event Timeline

uweigand updated this revision to Diff 53299.Apr 11 2016, 11:45 AM
uweigand retitled this revision from to Miscellaneous fixes for big-endian systems.
uweigand updated this object.
uweigand added a subscriber: lldb-commits.
clayborg accepted this revision.Apr 11 2016, 2:00 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Apr 11 2016, 2:00 PM
This revision was automatically updated to reflect the committed changes.