review request Bug 17116 - StackTrace::SlowUnwindStack dead locked
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Sep 10 02:45:04 PDT 2013
On Mon, Sep 9, 2013 at 2:09 PM, 林作健 <manjian2006 at gmail.com> wrote:
> Index: lib/asan/asan_thread.h
> ===================================================================
> --- lib/asan/asan_thread.h (revision 190121)
> +++ lib/asan/asan_thread.h (working copy)
> @@ -36,10 +36,12 @@
> explicit AsanThreadContext(int tid)
> : ThreadContextBase(tid),
> announced(false),
> + stacktracing(false),
> thread(0) {
> internal_memset(&stack, 0, sizeof(stack));
> }
> bool announced;
> + bool stacktracing;
Thread context objects live forever. Please move this to AsanThread.
> StackTrace stack;
> AsanThread *thread;
>
> @@ -86,6 +88,12 @@
> UnmapOrDie(fake_stack_, sizeof(FakeStack));
> }
> FakeStack *fake_stack() { return fake_stack_; }
> + bool isStacktracing() {
> + if (context()) {
> + return context()->stacktracing;
> + }
> + return false;
> + }
>
> AsanThreadLocalMallocStorage &malloc_storage() { return malloc_storage_;
> }
> AsanStats &stats() { return stats_; }
> @@ -107,6 +115,24 @@
> AsanStats stats_;
> };
>
> +// AsanStacktracingSink is a sink for stacktracing member of a context
> +class AsanStacktracingSink {
Please call it ScopedSomething. M/b ScopedInStackTrace or ScopedStacktracing.
> + public:
> + AsanStacktracingSink(AsanThread * t)
> + : thread(t) {
> + if(t->context()) {
> + t->context()->stacktracing = true;
> + }
> + }
> + ~AsanStacktracingSink() {
> + if(thread->context()) {
> + thread->context()->stacktracing = false;
> + }
> + }
> + private:
> + AsanThread * thread;
> +};
> +
> struct CreateThreadContextArgs {
> AsanThread *thread;
> StackTrace *stack;
> Index: lib/asan/asan_stack.h
> ===================================================================
> --- lib/asan/asan_stack.h (revision 190121)
> +++ lib/asan/asan_stack.h (working copy)
> @@ -36,14 +36,16 @@
> #define GET_STACK_TRACE_WITH_PC_AND_BP(max_s, pc, bp, fast) \
> StackTrace stack; \
> { \
> - uptr stack_top = 0, stack_bottom = 0; \
> AsanThread *t; \
> - if (asan_inited && (t = GetCurrentThread())) { \
> - stack_top = t->stack_top(); \
> - stack_bottom = t->stack_bottom(); \
> + stack.size = 0; \
> + if (asan_inited && (t = GetCurrentThread()) \
> + && !t->isStacktracing()) { \
> + uptr stack_top = t->stack_top(); \
> + uptr stack_bottom = t->stack_bottom(); \
> + AsanStacktracingSink sink(t); \
> + GetStackTrace(&stack, max_s, pc, bp, \
> + stack_top, stack_bottom, fast); \
> } \
> - GetStackTrace(&stack, max_s, pc, bp, \
> - stack_top, stack_bottom, fast); \
> }
> #endif // SANITIZER_WINDOWS
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list