[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
Tue Oct 10 06:33:08 PDT 2017


petpav01 updated this revision to Diff 118375.
petpav01 added a comment.

Updated patch contains the following changes:

- Remove comments for `DataExtractor::GetMaxU32()` and `GetMaxU64()` from `DataExtractor.cpp` and keep only the Doxygen ones in the header file.
- Restore assertion for `byte_size == 0` in `GetMaxU32()` and `GetMaxU64()`, change the assert text from "unhandled case" to "invalid byte_size" and replace `assert()` by `lldbassert()`.
- Update Doxygen documentation for `GetMaxU32()`, `GetMaxU64()`, `GetMaxS64()`, `GetMaxU64Bitfield()` and `GetMaxS64Bitfield()` to say that `byte_size` must be in interval [1,4/8] and remove that the methods return 0 if `byte_size` is bigger than 4/8 because that no longer holds. The patch retains the behaviour that LLDB does not crash in such cases but the returned value can be arbitrary. Note: This is something that I am not certain if I addressed properly. It seems to me this should be ok because the code now uses `lldbassert()` and so there will be always some error that something went wrong. An alternative is to add extra code that checks for `byte_size > 4/8` and returns 0 in such cases. Please let me know if that would be preferred.
- Enable `GetMaxU64_unchecked()` to also handle any `byte_size` in range [1,8] and add testing for this method in `DataExtractorTest.cpp`.


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.118375.patch
Type: text/x-patch
Size: 14564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171010/403bf2a5/attachment-0001.bin>


More information about the lldb-commits mailing list