Index: base/debug/task_annotator.cc |
diff --git a/base/debug/task_annotator.cc b/base/debug/task_annotator.cc |
index 3591fd6c80fc19016b4ed195233222fbc9c70808..d702599e593602b6dda2f472b7975cc5e7d30f9a 100644 |
--- a/base/debug/task_annotator.cc |
+++ b/base/debug/task_annotator.cc |
@@ -52,13 +52,15 @@ void TaskAnnotator::RunTask(const char* queue_function, |
"src_func", |
pending_task.posted_from.function_name()); |
- // Before running the task, store the program counter where it was posted |
- // and deliberately alias it to ensure it is on the stack if the task |
- // crashes. Be careful not to assume that the variable itself will have the |
- // expected value when displayed by the optimizer in an optimized build. |
- // Look at a memory dump of the stack. |
- const void* program_counter = pending_task.posted_from.program_counter(); |
- debug::Alias(&program_counter); |
+ // Before running the task, store the task backtrace with the chain of |
+ // PostTasks that resulted in this call and deliberately alias it to ensure |
+ // it is on the stack if the task crashes. Be careful not to assume that the |
+ // variable itself will have the expected value when displayed by the |
+ // optimizer in an optimized build. Look at a memory dump of the stack. |
+ const void* task_backtrace[4]; |
+ memcpy(&task_backtrace[0], &pending_task.task_backtrace[0], |
+ sizeof(task_backtrace)); |
+ debug::Alias(&task_backtrace); |
pending_task.task.Run(); |