Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index 1b73dcd310bea7fbf3d54405554f158c319ed162..db40045d85b0f58fc73288d920b1bd9d0137754a 100644 |
--- a/build/common.gypi |
+++ b/build/common.gypi |
@@ -238,6 +238,13 @@ |
# 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. -fintercept-allocated-type only works with the |
+ # modified clang, but clang_use_allocated_type=1 implies clang=1 |
+ # TODO(dmikurube): Add a link to a description page. |
+ # TODO(dmikurube): Support mac. |
Alexander Potapenko
2012/08/02 14:57:12
Note that tcmalloc does not work on Mac within Chr
Dai Mikurube (NOT FULLTIME)
2012/08/02 16:14:35
Ah, that's true. Thanks.
I have to find another a
|
+ 'clang_use_allocated_type%': 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, |
@@ -1181,6 +1188,12 @@ |
'clang%': 1, |
}], |
+ ['clang_use_allocated_type==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. |
# |
@@ -1586,6 +1599,28 @@ |
}], |
], # conditions for 'target_defaults' |
'target_conditions': [ |
+ ['_type=="executable" or _type=="loadable_module"', { |
+ 'target_conditions': [ |
+ ['_target_name=="mksnapshot" or _target_name=="protoc" or _target_name=="ppGoogleNaClPluginChrome"', { |
Dai Mikurube (NOT FULLTIME)
2012/08/02 07:43:55
Some binaries doesn't use tcmalloc. We use no-op
Alexander Potapenko
2012/08/02 14:57:12
Please write a comment about this.
Dai Mikurube (NOT FULLTIME)
2012/08/02 16:14:35
Yes, I'll do that. Thank you.
Dai Mikurube (NOT FULLTIME)
2012/08/03 10:01:50
Done.
|
+ # Ignore allocated types. |
+ 'conditions': [ |
+ ['clang==1 and clang_use_allocated_type==1', { |
+ 'dependencies': [ |
+ '<!(realpath <(DEPTH)/base/allocator/allocator.gyp)' + ':allocated_type_ignore#target', |
+ ]}, |
+ ], |
+ ]}, { |
+ # Store allocated types in TCMalloc's allocated_type_map (extended). |
+ 'conditions': [ |
+ ['clang==1 and clang_use_allocated_type==1', { |
+ 'dependencies': [ |
+ '<!(realpath <(DEPTH)/base/allocator/allocator.gyp)' + ':allocated_type_tcmalloc#target', |
Nico
2012/08/02 15:35:03
The realpath bit here shouldn't be needed
Dai Mikurube (NOT FULLTIME)
2012/08/02 16:14:35
It is actually needed because of http://crrev.com/
Nico
2012/08/02 16:18:49
No other dependency in gyp uses realpath though, r
Dai Mikurube (NOT FULLTIME)
2012/08/02 16:54:39
I guess it happens because it is a very hacky gyp
|
+ ]}, |
+ ], |
+ ]}, |
+ ] |
+ ]}, |
+ ], |
['enable_wexit_time_destructors==1', { |
'conditions': [ |
[ 'clang==1', { |
@@ -2329,6 +2364,22 @@ |
'-fcolor-diagnostics', |
], |
}], |
+ ['clang==1 and clang_use_allocated_type==1', { |
Alexander Potapenko
2012/08/03 09:57:07
If clang_use_allocated_type=1 implies clang=1, you
Dai Mikurube (NOT FULLTIME)
2012/08/07 10:39:18
Done.
|
+ 'cflags_cc!': ['-fno-rtti'], |
+ 'cflags_cc+': ['-gline-tables-only'], |
+ 'target_conditions': [ |
+ ['_target_name!="allocator" and _target_name!="allocator_extension_thunks" and _target_name!="libcmt" and _target_name!="allocator_extension_thunks_win64" and _target_name!="allocated_type_log" and _target_name!="allocated_type_ignore" and _target_name!="allocated_type_tcmalloc"', { |
+ 'cflags_cc+': [ |
+ '-frtti', |
+ '-fintercept-allocation-functions', |
+ '-I../../base/allocator', |
+ '-include', |
+ 'allocated_type.h', |
+ ], |
+ }], |
+ ], |
+ 'defines': ['USE_ALLOCATED_TYPE'], |
+ }], |
['asan==1', { |
'target_conditions': [ |
['_toolset=="target"', { |