[Lldb-commits] [PATCH] D38394: Fix dumping of characters with non-standard sizes

Petr Pavlu via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 29 02:50:55 PDT 2017


petpav01 created this revision.
Herald added subscribers: kristof.beyls, aemerson.

- Prevent dumping of characters in `DumpDataExtractor()` with `item_byte_size` bigger than 8 bytes. This case is not supported by the code and results in a crash because the code calls `DataExtractor::GetMaxU64Bitfield()` -> `GetMaxU64()` that asserts for byte size > 8 bytes.
- Teach `DataExtractor::GetMaxU64()`, `GetMaxU32()` and `GetMaxS64()` how to handle byte sizes that are not a multiple of 2. This allows `DumpDataExtractor()` to dump characters and booleans with `item_byte_size` in the interval of [1, 8] bytes. Values that are not a multiple of 2 would previously result in a crash because they were not handled by `GetMaxU64()`.

Examples of two commands that previously resulted in a crash when debugging an AArch64 target, and their new behaviour:

  (lldb) register read --format character v0
        v0 = error: unsupported byte size (16) for char format
  (lldb) memory read --format boolean --size 7 $sp
  0x7ffffffd70: false
  0x7ffffffd77: false
  [...]


https://reviews.llvm.org/D38394

Files:
  include/lldb/Utility/DataExtractor.h
  source/Core/DumpDataExtractor.cpp
  source/Utility/DataExtractor.cpp
  unittests/Core/DataExtractorTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38394.117106.patch
Type: text/x-patch
Size: 7866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170929/547c2eab/attachment.bin>


More information about the lldb-commits mailing list