diff options
author | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 01:01:05 +0000 |
---|---|---|
committer | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 01:01:05 +0000 |
commit | ad592bbbbdb78cafac28b789600b7fdd86adbb91 (patch) | |
tree | 81c55beb720b97d9fb051d2155d9154975a43495 /base/debug/profiler.h | |
parent | cc36c2c22e74ed768cfdf716a2486cdfd5e933d7 (diff) | |
download | chromium_src-ad592bbbbdb78cafac28b789600b7fdd86adbb91.zip chromium_src-ad592bbbbdb78cafac28b789600b7fdd86adbb91.tar.gz chromium_src-ad592bbbbdb78cafac28b789600b7fdd86adbb91.tar.bz2 |
Support the Syzygy instrumenting profiler.
This change depends on a new API in V8 to support return-address rewriting profilers, landed at http://code.google.com/p/v8/source/detail?r=10845.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/9477002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug/profiler.h')
-rw-r--r-- | base/debug/profiler.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/base/debug/profiler.h b/base/debug/profiler.h index 69795a5..d880324 100644 --- a/base/debug/profiler.h +++ b/base/debug/profiler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include <string> #include "base/base_export.h" +#include "base/basictypes.h" // The Profiler functions allow usage of the underlying sampling based // profiler. If the application has not been built with the necessary @@ -34,6 +35,33 @@ BASE_EXPORT bool BeingProfiled(); // Reset profiling after a fork, which disables timers. BASE_EXPORT void RestartProfilingAfterFork(); +// Returns true iff this executable is instrumented with the Syzygy profiler. +BASE_EXPORT bool IsBinaryInstrumented(); + +// There's a class of profilers that use "return address swizzling" to get a +// hook on function exits. This class of profilers uses some form of entry hook, +// like e.g. binary instrumentation, or a compiler flag, that calls a hook each +// time a function is invoked. The hook then switches the return address on the +// stack for the address of an exit hook function, and pushes the original +// return address to a shadow stack of some type. When in due course the CPU +// executes a return to the exit hook, the exit hook will do whatever work it +// does on function exit, then arrange to return to the original return address. +// This class of profiler does not play well with programs that look at the +// return address, as does e.g. V8. V8 uses the return address to certain +// runtime functions to find the JIT code that called it, and from there finds +// the V8 data structures associated to the JS function involved. +// A return address resolution function is used to fix this. It allows such +// programs to resolve a location on stack where a return address originally +// resided, to the shadow stack location where the profiler stashed it. +typedef uintptr_t (*ReturnAddressLocationResolver)( + uintptr_t return_addr_location); + +// If this binary is instrumented and the instrumentation supplies a return +// address resolution function, finds and returns the address resolution +// function. Otherwise returns NULL. +BASE_EXPORT ReturnAddressLocationResolver + GetProfilerReturnAddrResolutionFunc(); + } // namespace debug } // namespace base |