Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 79723f6cc76c041697955f5c7de91e2935e78aa5..7e65dfa41cf0301123c3af3e376133a59d6eb3fb 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -231,10 +231,13 @@ config("compiler") { |
# Non-Mac Posix compiler flags setup. |
# ----------------------------------- |
if (is_posix && !(is_mac || is_ios)) { |
- if (enable_profiling) { |
- # Explicitly ask for frame pointers. Otherwise they are omitted when |
- # any optimization level is used (and Android debug builds use -Os). |
+ if (enable_profiling || is_debug) { |
+ # Explicitly ask for frame pointers, otherwise they are omitted when |
+ # any optimization level is used (Android debug builds use -Os.) |
+ # This prevents stack frames from working when profiling, and can cause |
+ # crashes when unwinding stack frames (crbug.com/636489). |
Dirk Pranke
2016/08/22 20:03:48
Do we have any idea what the perf impact of -fno-o
vmiura
2016/08/22 20:32:04
I don't have data but I expect the impact is fairl
|
cflags += [ "-fno-omit-frame-pointer" ] |
+ |
if (!is_debug) { |
cflags += [ "-g" ] |
@@ -1274,6 +1277,13 @@ if (is_win) { |
"-ffunction-sections", |
] |
+ if (is_debug) { |
+ # Explicitly ask for frame pointers, otherwise they are omitted when |
+ # any optimization level is used and can cause crashes when unwinding |
+ # stack frames (crbug.com/636489). |
+ common_optimize_on_cflags += [ "-fno-omit-frame-pointer" ] |
+ } |
+ |
common_optimize_on_ldflags += [ |
# Specifically tell the linker to perform optimizations. |
# See http://lwn.net/Articles/192624/ . |