[PATCH] D91183: Added GDB pretty printer for StringMap

Moritz Sichert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 01:11:50 PST 2020


MoritzS added inline comments.


================
Comment at: llvm/utils/gdb-scripts/prettyprinters.py:215
+    entry_ty = gdb.lookup_type('llvm::StringMapEntry<{}>'.format(value_ty.name))
+    tombstone = ((1 << (64 - 3)) - 1) << 3
+
----------------
dblaikie wrote:
> Any chance we could avoid hardcoding the tombstone value here? I guess maybe if the source were modified to store the tombstone value as a constexpr (not sure if it could be constexpr - with the pointer bitfiddling, etc - but maybe) member of StringMapImpl, would that be accessible from the pretty printer reliably? 
I could call StringMapImpl::getTombstoneVal() from gdb to get it, but that depends on that function to not be optimized out. But this kind of function is pretty likely to be inlined and optimized out even with -O1. Even with a constexpr member I think that would have the same problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91183



More information about the llvm-commits mailing list