Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
We wanted to record stack traces to some databases for post-process. This is similar to the request of printing dfsan origin traces to a buffer.
compiler-rt/lib/dfsan/dfsan.cpp | ||
---|---|---|
845 | Please replace __sanitizer_print_stack_trace by dfsan_print_stack_trace. The only difference between them is that __sanitizer_print_stack_trace uses common_flags()->fast_unwind_on_fatal. | |
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h | ||
142 ↗ | (On Diff #351611) | @vitalybuka: is fine to make this public? If not, it is still fine for dfsan_sprint_stack_trace, because we can always post-process stack frames to fill out unrelated frames. |
To clarify, I understand why you need dfsan_sprint_stack_trace.
But dfsan_print_stack_trace looks very similar to sanitizer_print_stack_trace.
Please consider to adjust your use-case and just use sanitizer_print_stack_trace.
But please don't wait for my review and proceed with @stephan.yichao.zhao if you disagree.
compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h | ||
---|---|---|
142 ↗ | (On Diff #351611) | fine with me |
compiler-rt/lib/dfsan/dfsan.cpp | ||
---|---|---|
845 | Not sure what the suggestion is. You mean I should remove __sanitizer_print_stack_trace altogether? Or replace its body with a call to dfsan_print_stack_trace? Or something else? Not sure if removing is okay, since I see a declaration provided in sanitizer/common_interface_defs.h and every *san.cpp provides its own definition. Having one call the other will insert another frame and I really don't want to use/introduce a macro like GET_FATAL_STACK_TRACE_PC_BP that hides the declaration of stack (which makes the code below harder to understand since we call many methods of stack but its type is not evident). Unless we replace it with an inlined function. |
compiler-rt/lib/dfsan/dfsan.cpp | ||
---|---|---|
845 | I suggest we keep __sanitizer_print_stack_trace, and could define it like void __sanitizer_print_stack_trace() { GET_CALLER_PC_BP; GET_STORE_STACK_TRACE_PC_BP(pc, bp); stack.Print(); } It is fine to remove GET_FATAL_STACK_TRACE_PC_BP because in our case the 4th argument is always true. |
compiler-rt/test/dfsan/stack_trace.c | ||
---|---|---|
52 |
Please replace __sanitizer_print_stack_trace by dfsan_print_stack_trace.
The only difference between them is that __sanitizer_print_stack_trace uses common_flags()->fast_unwind_on_fatal.
I think that controls fast unwind. Since DFSan always runs on linux where fast unwind can also be supported, so that flag is true.