[compiler-rt] [compiler-rt] Write ASAN/TSAN reports to a global for crash reporting (PR #200526)
Dan Blackwell via llvm-commits
llvm-commits at lists.llvm.org
Sat May 30 02:34:08 PDT 2026
================
@@ -1606,6 +1609,50 @@ void InstallPthreadIntrospectionHook(const ThreadEventCallbacks &callbacks) {
pthread_introspection_hook_install(&sanitizer_pthread_introspection_hook);
}
+void GetDarwinStack(
+ InternalMmapVector<llvm_sanitizer_report_payload_stack_v1>& stacks, int tid,
+ const StackTrace* s, uint16_t type, const char* description,
+ bool includeThreadName) {
+ stacks.resize(stacks.size() + 1);
+ llvm_sanitizer_report_payload_stack_v1& res = stacks.back();
+ res.type = type;
+ res.stack.thread_id = tid;
+ res.stack.time = 0;
+ res.stack.num_frames = Min(
+ (size_t)s->size, sizeof(res.stack.frames) / sizeof(res.stack.frames[0]));
+ for (size_t i = 0; i < res.stack.num_frames; i++) {
+ res.stack.frames[i] = s->trace[res.stack.num_frames - i - 1];
+ }
+ if (includeThreadName) {
+ internal_snprintf(res.description, sizeof(res.description),
+ "%s by thread %d", description, tid);
+ } else {
+ internal_strncpy(res.description, description, sizeof(res.description));
----------------
DanBlackwell wrote:
Is this guaranteed to fit / is it read back as a string? strncpy won't null-terminate if it fills the buffer
https://github.com/llvm/llvm-project/pull/200526
More information about the llvm-commits
mailing list