[Lldb-commits] [lldb] [lldb] Call FixUpPointer in WritePointerToMemory (try 2) (PR #153585)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 3 02:03:31 PDT 2025


================
@@ -0,0 +1,19 @@
+#include <assert.h>
+#include <stdint.h>
+#include <stdio.h>
+
+int myglobal = 41;
+
+uint64_t get_high_bits(void *ptr) {
+  uint64_t mask = ~((1ULL << 48) - 1);
+  uint64_t ptrtoint = (uint64_t)ptr;
+  uint64_t high_bits = ptrtoint & mask;
+  printf("Higher bits are = %llx\n", high_bits);
+  return high_bits;
+}
+
+int main() {
+  int x = 42;
+  assert(0 == get_high_bits(&x));
----------------
DavidSpickett wrote:

Not sure we need this, or x. If the address of x is already tagged that means we've been built with some stack tagging scheme.

Even in that case lldb will strip the tag bits from the address anyway. Rightly or wrongly, but this test is not about right and wrong it's basically documentation.

So unless there's another reason you need this, I'd remove it.

https://github.com/llvm/llvm-project/pull/153585


More information about the lldb-commits mailing list