Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions compiler-rt/lib/asan/asan_descriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ void DescribeThread(AsanThreadContext *context) {
return;
}
context->announced = true;

AsanThreadContext *parent_context =
context->parent_tid == kInvalidTid
? nullptr
: GetThreadContextByTidLocked(context->parent_tid);

// `context->parent_tid` may point to reused slot. Check `unique_id` which
// is always smaller for the parent, always greater for a new user.
if (context->unique_id <= parent_context->unique_id)
parent_context = nullptr;

InternalScopedString str;
str.AppendF("Thread %s", AsanThreadIdAndName(context).c_str());
if (context->parent_tid == kInvalidTid) {
if (!parent_context) {
str.Append(" created by unknown thread\n");
Printf("%s", str.data());
return;
Expand All @@ -60,11 +71,8 @@ void DescribeThread(AsanThreadContext *context) {
Printf("%s", str.data());
StackDepotGet(context->stack_id).Print();
// Recursively described parent thread if needed.
if (flags()->print_full_thread_history) {
AsanThreadContext *parent_context =
GetThreadContextByTidLocked(context->parent_tid);
if (flags()->print_full_thread_history)
DescribeThread(parent_context);
}
}

// Shadow descriptions
Expand Down
Loading