[Lldb-commits] [lldb] [debugserver] Support for `qMemTags` packet (PR #160952)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 29 04:18:26 PDT 2025


================
@@ -0,0 +1,29 @@
+#include <malloc/malloc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// Produce some names on the trace
+const size_t tag_granule = 16;
+uint8_t *my_malloc(void) { return malloc(2 * tag_granule); }
+uint8_t *allocate(void) { return my_malloc(); }
+
+void my_free(void *ptr) { free(ptr); }
+void deallocate(void *ptr) { my_free(ptr); }
+
+void touch_memory(uint8_t *ptr) { ptr[7] = 1; } // invalid access
+void modify(uint8_t *ptr) { touch_memory(ptr); }
+
+int main() {
+  uint8_t *ptr = allocate();
+  printf("ptr: %p\n", ptr);
----------------
DavidSpickett wrote:

Remove debug print. If you need it in the test case, prefer assigning it to a global and reading it out that way.

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


More information about the lldb-commits mailing list