llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.35k stars 12.14k forks source link

Custom stack traces in sanitizers #61496

Open denizevrenci opened 1 year ago

denizevrenci commented 1 year ago

One very useful feature of ASAN and the other sanitizers is the stack trace we get when the problematic code is executed. However, the stack traces are a lot less useful when we have coroutines that may resume in different threads, in that case, the trace before the resumption is belonging to the thread or thread pool creation. Folly introduced the mechanism to get stack traces from async contexts. As far as I am aware, sanitizers do not have the ability to override the stack trace mechanism:

I would like to flag this as an enhancement for the sanitizer infrastructure.

llvmbot commented 1 year ago

@llvm/issue-subscribers-coroutines

romasandu-gaijin commented 4 months ago

I would like to note that this will be useful not only for coroutines, but also for various embedded scripting languages. A callstack that leads deep inside the C++ VM executing the script is not useful at all, so it would be nice if there was a hook to override it with a proper call stack of the scripting language itself.