[Lldb-commits] [lldb] [lldb][API] Add Find(Ranges)InMemory() to Process SB API (PR #95007)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 10 14:04:35 PDT 2024


================
@@ -0,0 +1,21 @@
+#include <cstring>
+
+int main() {
+  constexpr char SINGLE_INSTANCE_STRING[] = "there_is_only_one_of_me";
+  constexpr size_t single_instance_size = sizeof(SINGLE_INSTANCE_STRING) + 1;
+  char *single_instance = new char[single_instance_size];
+  strcpy(single_instance, SINGLE_INSTANCE_STRING);
----------------
clayborg wrote:

So we don't need lines 5-7 if we want to search the thread stack. You can make a local variable that points to this buffer to make sure it is used and stays in the program:
```
const char *stack_string_ptr = SINGLE_INSTANCE_STRING;
```

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


More information about the lldb-commits mailing list