Commit e37c0444 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[base] Stomp task_backtrace at the end of TaskAnnotator::RunTask

Leaving it there resulted in it being picked up on urelated stacks.

R=ajwong@chromium.org

Bug: 1073500
Change-Id: If8816da156e89122d3c599e1f355e9d6703940b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2161465
Commit-Queue: Albert J. Wong <ajwong@chromium.org>
Reviewed-by: default avatarAlbert J. Wong <ajwong@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762040}
parent 973ebbe8
......@@ -142,6 +142,15 @@ void TaskAnnotator::RunTask(const char* trace_event_name,
std::move(pending_task->task).Run();
tls->Set(previous_pending_task);
// Stomp the markers. Otherwise they can stick around on the unused parts of
// stack and cause |task_backtrace| to be associated with an unrelated stack
// sample on this thread later in the event of a crash. Alias once again after
// these writes to make sure the compiler doesn't optimize them out (unused
// writes to a local variable).
task_backtrace.front() = nullptr;
task_backtrace.back() = nullptr;
debug::Alias(&task_backtrace);
}
uint64_t TaskAnnotator::GetTaskTraceID(const PendingTask& task) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment