[PATCH] D88988: [llvm-symbolizer] Add inline stack traces for Windows.
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 20 15:58:45 PDT 2020
rnk added a comment.
In D88988#2322424 <https://reviews.llvm.org/D88988#2322424>, @akhuang wrote:
> Ok, as far as I can tell, all of the asan tests are failing for the same reason-- the symbolizer now outputs an extra line for __sanitizer::BufferedStackTrace::Unwind.
>
> #0 0x7ff6f9fa7e64 in __sanitizer::BufferedStackTrace::Unwind C:\src\llvm-project\compiler-rt\lib\sanitizer_common\sanitizer_stacktrace.h:124
> #1 0x7ff6f9fa7e64 in malloc C:\src\llvm-project\compiler-rt\lib\asan\asan_malloc_win.cpp:98
I guess I misspoke when we chatted, I think we need to avoid these extra frames. Here's the line of code that I think is executing:
https://github.com/llvm/llvm-project/blob/d784f7406911c4fb6bc559320f7f9ff134be7ff5/compiler-rt/lib/asan/asan_stack.h#L45
stack.Unwind(StackTrace::GetCurrentPc(), \
GET_CURRENT_FRAME(), nullptr, fast, max_size); \
Here's what I think might be happening: in the MS C++ ABI, argument evaluation has to be right-to-left. On Linux, it is left to right. So, on Linux, we get assembly that looks like this:
callq GetCurrentPC
movq $0, %rdi # set up other args
...
# inlined callsite for Unwind
But on Windows, that's rearranged like so:
movq $0, %rcx # set up other args
callq GetCurrentPc # set up rightmost arg last
# inlined call site for Unwind
I guess to sort it all out, the thing to do is to get the annotated assembly produced by clang-cl, and look at the assembly stream. It will have the human-readable .cv_loc directives to help us work out where to apply the fix. We could, for example, subtract one from the result of GetCurrentPc().
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88988/new/
https://reviews.llvm.org/D88988
More information about the llvm-commits
mailing list