[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

Marco Elver via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 23:49:58 PDT 2025


================
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the CF table at startup:
     // the collected control flow.
   }
 
+Tracing Stack Depth
+===================
+
+With ``-fsanitize-coverage=stack-depth`` the compiler will track how much
+stack space has been used for a function call chain. Leaf functions are
+not included in this tracing.
+
+The maximum depth of a function call graph is stored in the thread-local
+``__sancov_lowest_stack`` variable. Instrumentation is inserted in every
+non-leaf function to check the stack pointer against this variable,
----------------
melver wrote:

You write "stack pointer" here, but in the below it's "frame pointer", which are different.

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


More information about the llvm-commits mailing list