[Lldb-commits] [PATCH] D114458: Make some libstd++ formatters safer

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 23 10:41:23 PST 2021


labath added inline comments.


================
Comment at: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered/main.cpp:16
 
-int main() {
+int main() {  // Set break point at this line.
   std::unordered_map<int, std::string> map;
----------------
It'd be better to be more explicit about the contents of this "uninitialized" memory.
For example you could allocate a char array of an appropriate size, memset it to zero (or whatever), and then cast its address to a map pointer.

Otherwise you run the risk of flakyness due to random data showing up in that block of memory.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114458



More information about the lldb-commits mailing list