summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorwittman <wittman@chromium.org>2015-04-17 19:24:10 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-18 02:24:55 +0000
commit9eb41ed9114056cf2f2bf7e6b969b0103cb1246a (patch)
tree4c307c21cc5e0f958045b918c930c112629e02bf /base
parent043b12724072abaa5f49ae73ef9a150515598af4 (diff)
downloadchromium_src-9eb41ed9114056cf2f2bf7e6b969b0103cb1246a.zip
chromium_src-9eb41ed9114056cf2f2bf7e6b969b0103cb1246a.tar.gz
chromium_src-9eb41ed9114056cf2f2bf7e6b969b0103cb1246a.tar.bz2
Don't chase stack frames through dodgy third party library code
Should fix most or all of the crashes with the signature from the associated bug. BUG=476422 Review URL: https://codereview.chromium.org/1087673004 Cr-Commit-Position: refs/heads/master@{#325765}
Diffstat (limited to 'base')
-rw-r--r--base/profiler/stack_sampling_profiler_win.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/base/profiler/stack_sampling_profiler_win.cc b/base/profiler/stack_sampling_profiler_win.cc
index 93014ad..1ccd134 100644
--- a/base/profiler/stack_sampling_profiler_win.cc
+++ b/base/profiler/stack_sampling_profiler_win.cc
@@ -46,12 +46,20 @@ int RecordStack(CONTEXT* context,
RtlVirtualUnwind(0, image_base, context->Rip, runtime_function, context,
&handler_data, &establisher_frame, &nvcontext);
} else {
- // If we don't have a RUNTIME_FUNCTION, then we've encountered a leaf
- // function. Adjust the stack appropriately prior to the next function
- // lookup.
- context->Rip = *reinterpret_cast<PDWORD64>(context->Rsp);
- context->Rsp += 8;
- *last_frame_is_unknown_function = true;
+ // If we don't have a RUNTIME_FUNCTION, then in theory this should be a
+ // leaf function whose frame contains only a return address, at
+ // RSP. However, crash data also indicates that some third party libraries
+ // do not provide RUNTIME_FUNCTION information for non-leaf functions. We
+ // could manually unwind the stack in the former case, but attempting to
+ // do so in the latter case would produce wrong results and likely crash,
+ // so just bail out.
+ //
+ // Ad hoc runs with instrumentation show that ~5% of stack traces end with
+ // a valid leaf function. To avoid selectively omitting these traces it
+ // makes sense to ultimately try to distinguish these two cases and
+ // selectively unwind the stack for legitimate leaf functions. For the
+ // purposes of avoiding crashes though, just ignore them all for now.
+ return i;
}
}
return i;