diff options
author | Julian Lettner <jlettner@apple.com> | 2019-02-27 22:16:02 +0000 |
---|---|---|
committer | Julian Lettner <jlettner@apple.com> | 2019-02-27 22:16:02 +0000 |
commit | b8655cd8bcda83fc404ef4e71359da6bcdbd651b (patch) | |
tree | 936deb2005c394fa610288eab6e5785eee7c40f0 /lib/sanitizer_common/sanitizer_stacktrace.h | |
parent | 9eaaaf1ff6c2c130c3013173312eb1b59813011b (diff) | |
download | compiler-rt-b8655cd8bcda83fc404ef4e71359da6bcdbd651b.tar.gz |
[NFC][Sanitizer] Pull up GetStackTrace into sanitizer_common
We already independently declare GetStackTrace in all (except TSan)
sanitizer runtime headers. Lets move it to sanitizer_stacktrace.h to
have one canonical way to fill in a BufferedStackFrame. Also enables us
to use it in sanitizer_common itself.
This patch defines GetStackTrace for TSan and moves the function from
ubsan_diag.cc to ubsan_diag_standalone.cc to avoid duplicate symbols
for the UBSan-ASan runtime.
Other than that this patch just moves the code out of headers and into
the correct namespace.
Reviewers: vitalybuka
Differential Revision: https://reviews.llvm.org/D58651
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355039 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stacktrace.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_stacktrace.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_stacktrace.h b/lib/sanitizer_common/sanitizer_stacktrace.h index e9bcf3a17..eeed983f6 100644 --- a/lib/sanitizer_common/sanitizer_stacktrace.h +++ b/lib/sanitizer_common/sanitizer_stacktrace.h @@ -121,6 +121,12 @@ static inline bool IsValidFrame(uptr frame, uptr stack_top, uptr stack_bottom) { return frame > stack_bottom && frame < stack_top - 2 * sizeof (uhwptr); } +// Get the stack trace with the given pc and bp. +// The pc will be in the position 0 of the resulting stack trace. +// The bp may refer to the current frame or to the caller's frame. +void GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc, uptr bp, + void *context, bool request_fast_unwind); + } // namespace __sanitizer // Use this macro if you want to print stack trace with the caller |