diff options
| author | Kostya Serebryany <kcc@google.com> | 2018-09-05 01:16:50 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2018-09-05 01:16:50 +0000 |
| commit | 5d05be84b7cdcb9160d49167ec78d4555a18f405 (patch) | |
| tree | 78206833148fe6ee707c38e3dd0d98f64d61da0b /compiler-rt/lib/hwasan/hwasan_thread.cc | |
| parent | 8806e512bbf464fcaf337a0d323ae0db924d47e1 (diff) | |
| download | bcm5719-llvm-5d05be84b7cdcb9160d49167ec78d4555a18f405.tar.gz bcm5719-llvm-5d05be84b7cdcb9160d49167ec78d4555a18f405.zip | |
[hwasan] print thread IDs when reporting a bug (also had to fix pthread_create on Linux)
llvm-svn: 341438
Diffstat (limited to 'compiler-rt/lib/hwasan/hwasan_thread.cc')
| -rw-r--r-- | compiler-rt/lib/hwasan/hwasan_thread.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler-rt/lib/hwasan/hwasan_thread.cc b/compiler-rt/lib/hwasan/hwasan_thread.cc index f3dc9745058..ce19e16d341 100644 --- a/compiler-rt/lib/hwasan/hwasan_thread.cc +++ b/compiler-rt/lib/hwasan/hwasan_thread.cc @@ -63,10 +63,11 @@ void Thread::Create() { uptr size = RoundUpTo(sizeof(Thread), PageSize); Thread *thread = (Thread*)MmapOrDie(size, __func__); thread->destructor_iterations_ = GetPthreadDestructorIterations(); - thread->random_state_ = flags()->random_tags ? RandomSeed() : 0; + thread->unique_id_ = unique_id++; + thread->random_state_ = + flags()->random_tags ? RandomSeed() : thread->unique_id_; if (auto sz = flags()->heap_history_size) thread->heap_allocations_ = RingBuffer<HeapAllocationRecord>::New(sz); - thread->unique_id_ = unique_id++; InsertIntoThreadList(thread); SetCurrentThread(thread); thread->Init(); @@ -100,7 +101,7 @@ void Thread::Init() { CHECK(MemIsApp(stack_top_ - 1)); } if (flags()->verbose_threads) - Print("Creating "); + Print("Creating : "); } void Thread::ClearShadowForThreadStackAndTLS() { @@ -112,7 +113,7 @@ void Thread::ClearShadowForThreadStackAndTLS() { void Thread::Destroy() { if (flags()->verbose_threads) - Print("Destroying"); + Print("Destroying: "); malloc_storage().CommitBack(); ClearShadowForThreadStackAndTLS(); RemoveFromThreadList(this); @@ -124,8 +125,8 @@ void Thread::Destroy() { } void Thread::Print(const char *Prefix) { - Printf("%s: thread %p id: %zd stack: [%p,%p) sz: %zd tls: [%p,%p)\n", Prefix, - this, unique_id_, stack_bottom(), stack_top(), + Printf("%sT%zd %p stack: [%p,%p) sz: %zd tls: [%p,%p)\n", Prefix, + unique_id_, this, stack_bottom(), stack_top(), stack_top() - stack_bottom(), tls_begin(), tls_end()); } |

