[PATCH] D117779: [LLDB] Add formatters for PointerIntPair, PointerUnion

Sergej Jaskiewicz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 21 07:56:54 PST 2022


broadwaylamb added a comment.

In D117779#3258798 <https://reviews.llvm.org/D117779#3258798>, @kastiglione wrote:

> I take it these expression evaluations are necessary?

Well, I think they are. There is too much template magic behind figuring out how much bits in the pointer we use to store an additional integer value.

Expression evaluations are not only slow, but they also prevent us from formatting nested PointerIntPairs, since the expression path is modified and doesn't correspond to the actual implementation anymore, therefore evaluating expressions down the tree will not work.
But I guess we can live with that for now.



================
Comment at: llvm/utils/lldbDataFormatters.py:175
         max_length = 256
-        length = valobj.GetChildAtIndex(1).GetValueAsUnsigned(max_length)
+        length = min(max_length, valobj.GetChildAtIndex(1).GetValueAsUnsigned(max_length))
         if length == 0:
----------------
kastiglione wrote:
> when the string length is greater than `max_length`, it would be nice for the returned string to indicate truncation. I just checked a long `std::string` and the output was:
> 
> ```
> "really long string"...
> ```
> 
> Also the max length for `std::string` is 1024, should `StringRef` use 1024 too?
LLDB supports the `max-string-summary-length` setting, but unfortunately there is no way to get the value of that setting through Python API.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117779/new/

https://reviews.llvm.org/D117779



More information about the llvm-commits mailing list