[PATCH] D27656: [tsan] Implement __tsan_get_alloc_stack to query the allocation stack of a heap pointer

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 11:49:38 PST 2016

dvyukov added inline comments.

Comment at: lib/tsan/rtl/tsan_debugging.cc:168
+int __tsan_get_alloc_stack(uptr addr, uptr *trace, uptr size, int *thread_id,
+                           uptr *os_id) {
+  MBlock *b = 0;
Since the interface is different from asan, it may makes sense to return block begin and size as well. What do you think?

Comment at: lib/tsan/rtl/tsan_debugging.cc:181
+  ThreadContextBase *tctx = ctx->thread_registry->GetThreadLocked(b->tid);
+  *os_id = tctx->os_id;
os_id can be stale if status is not ThreadStatusRunning
I think it's better to return something more predictable in such case, e.g. 0.



More information about the llvm-commits mailing list