[Lldb-commits] [PATCH] D124113: [lldb] Adjust libc++ string formatter for changes in D123580

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 21 01:41:44 PDT 2022


labath added inline comments.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp:658
+  if (!using_bitmasks)
+    capacity *= 2;
   if (size == LLDB_INVALID_OFFSET || capacity == LLDB_INVALID_OFFSET ||
----------------
philnik wrote:
> This should only be done if the string is in the normal layout and little endian or in the alternate layout and big endian. Why do you care about the capacity at all? Isn't that just another point of failure?
I've added the layout check and made a note that big-endian is not supported. The capacity check comes from <https://reviews.llvm.org/D73860>, but I'm not sure of the overall purpose. I guess it was trying to screen out corrupt/uninitialized string objects, but I'm not convinced that we're doing anyone a favour by refusing to format those -- after all, the application itself might access such objects without checking the capacity, and operate on the data that we've decided to ignore.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124113



More information about the lldb-commits mailing list