[PATCH] [compiler-rt] bug 23600 - sanitizer stack trace pc off by 1
msebor at gmail.com
Wed May 27 14:41:19 PDT 2015
Comment at: test/sanitizer_common/TestCases/print-stack-trace-pc.cc:1
@@ +1,2 @@
+// Run each sanitizer test with XSAN_SYMBOLIZER_PATH pointing at
+// bin/llvm-symbolizer and with XSAN_OPTIONS set to a stack trace
> That's a great test to have, but it is not testing the case with signals, is it?
No, it isn't. It didn't seem too important since the code that generates the stack trace is the same in either case.
What seemed more important to me and what's not covered is testing the PC value for the active frame. Unfortunately, I'm not aware of a straightforward and portable way of getting the PC value in this case. I considered two approaches to verifying that the PC value for the active frame when the stack trace is generated in response to a signal:
1) Invoke GDB and have it print the stack trace and use it for comparison.
2) Handle the signal, extract and print the PC value in it, and raise it again to let the sanitizer generate its own.
I rejected (1) because I couldn't find any other tests that relied on GDB and introducing a dependency for just this one test seemed like overkill. Adding the machinery to invoke GDB also seemed like a nontrivial effort that I cannot justify.
(2) should be doable on POSIX using sigaction and siginfo_t but wouldn't work on non-POSIX targets. Since I don't have access to such targets I decided to keep the test simple at the expense of not exercising this case.
If you can suggest a portable way that's not overly involved I'd be happy to code it up.
More information about the llvm-commits