summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authordmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-26 05:17:25 +0000
committerdmikurube@chromium.org <dmikurube@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-26 05:17:25 +0000
commit7ce58b29d323d6da838330661a80c67b7871734b (patch)
tree94b8367342219267b3fc3c91c82b0cbde532b784 /build
parent75693935c15c7d02e3dc3ebe92d8d6a32f44e711 (diff)
downloadchromium_src-7ce58b29d323d6da838330661a80c67b7871734b.zip
chromium_src-7ce58b29d323d6da838330661a80c67b7871734b.tar.gz
chromium_src-7ce58b29d323d6da838330661a80c67b7871734b.tar.bz2
Type profiler by intercepting 'new' and 'delete' expressions.
It stores mapping between object's starting addresses and their allocated types when a build option 'clang_type_profiler=1' is specified. It enables information like "an object at 0x37f3c88 is an instance of std::string." Nothing is changed when the option is not specified. It depends on a modified version of the LLVM/Clang compiler introduced at deps/third_party/llvm-allocated-type. BUG=123758 TEST=build with clang_type_profiler=1 and run type_profiler_unittests and type_profiler_map_unittests manually. Review URL: https://chromiumcodereview.appspot.com/10411047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r--build/common.gypi25
1 files changed, 25 insertions, 0 deletions
diff --git a/build/common.gypi b/build/common.gypi
index a993fb0..9c8094b 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -253,6 +253,12 @@
# See http://clang.llvm.org/docs/ThreadSanitizer.html
'tsan%': 0,
+ # Use a modified version of Clang to intercept allocated types and sizes
+ # for allocated objects. clang_type_profiler=1 implies clang=1.
+ # See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier
+ # TODO(dmikurube): Support mac. See http://crbug.com/123758#c11
+ 'clang_type_profiler%': 0,
+
# Set to true to instrument the code with function call logger.
# See src/third_party/cygprofile/cyg-profile.cc for details.
'order_profiling%': 0,
@@ -633,6 +639,7 @@
'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
'asan%': '<(asan)',
'tsan%': '<(tsan)',
+ 'clang_type_profiler%': '<(clang_type_profiler)',
'order_profiling%': '<(order_profiling)',
'order_text_section%': '<(order_text_section)',
'enable_extensions%': '<(enable_extensions)',
@@ -1276,6 +1283,12 @@
'clang%': 1,
}],
+ ['OS=="linux" and clang_type_profiler==1', {
+ 'clang%': 1,
+ 'clang_use_chrome_plugins%': 0,
+ 'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
+ }],
+
# On valgrind bots, override the optimizer settings so we don't inline too
# much and make the stacks harder to figure out.
#
@@ -1426,6 +1439,18 @@
],
},
'conditions': [
+ ['OS=="linux" and linux_use_tcmalloc==1 and clang_type_profiler==1', {
+ 'cflags_cc!': ['-fno-rtti'],
+ 'cflags_cc+': [
+ '-frtti',
+ '-gline-tables-only',
+ '-fintercept-allocation-functions',
+ ],
+ 'defines': ['TYPE_PROFILING'],
+ 'dependencies': [
+ '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
+ ],
+ }],
['OS=="win" and "<(msbuild_toolset)"!=""', {
'msbuild_toolset': '<(msbuild_toolset)',
}],