================
@@ -0,0 +1,86 @@
+#include <stdlib.h>
+
+// A simple, deterministic, single-threaded nested call chain. We stop at the
+// innermost function and walk the stack.
+//
+// The breakpoint is in the innermost frame (func_e), and that frame carries
+// locals of every kind, so that examining *just the stopped frame* already
+// exercises the various memory-read paths in one frame:
+// - scalar locals (int / long / double)
+// - aggregate locals (a struct and a fixed stack array)
+// - pointer locals, including a pointer to heap memory
+//
+// The outer frames (func_d / func_c) also carry locals of these kinds, so that
+// walking the whole stack and examining every frame reads the same variety of
+// memory across several frames.
+//
+// The frame-pointer backchain is expedited at the public stop, so the
backtrace
+// itself is packet-free; reading the *values* of these locals is not expedited
+// and must read memory from the stub.
+//
+// noinline + a real use of every value keeps every frame and local live (no
+// inlining, no tail-call folding, nothing optimized away).
+
+#define HEAP_COUNT 8
+
+// A volatile sink so the locals are observably used.
+volatile long g_sink;
+
+struct Stats {
+ long sum;
+ long min;
+ long max;
+ double mean;
+};
+
+// The innermost frame, where we stop. It carries every kind of local: a
+// scalar, aggregates (struct + array), and pointers (including one into heap
+// memory). Examining this single frame on a stop reads both stack and
+// heap memory.
+static int __attribute__((noinline)) func_e(int depth) {
+ int i = depth + 1;
----------------
qiyao wrote:
That is a good idea, a variable sized local array is added.
https://github.com/llvm/llvm-project/pull/205897
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits