Skip to content

Commit 9ea9b47

Browse files
committed
Fix debug symbols logic on platform=web to match Godot core.
1 parent 8bb931c commit 9ea9b47

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/common_compiler_flags.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import subprocess
33

44

5+
def using_emcc(env):
6+
return "emcc" in os.path.basename(env["CC"])
7+
8+
59
def using_clang(env):
610
return "clang" in os.path.basename(env["CC"])
711

@@ -89,7 +93,13 @@ def generate(env):
8993
# Adding dwarf-4 explicitly makes stacktraces work with clang builds,
9094
# otherwise addr2line doesn't understand them.
9195
env.Append(CCFLAGS=["-gdwarf-4"])
92-
if env.dev_build:
96+
if using_emcc(env):
97+
# Emscripten only produces dwarf symbols when using "-g3".
98+
env.AppendUnique(CCFLAGS=["-g3"])
99+
# Emscripten linker needs debug symbols options too.
100+
env.AppendUnique(LINKFLAGS=["-gdwarf-4"])
101+
env.AppendUnique(LINKFLAGS=["-g3"])
102+
elif env.dev_build:
93103
env.Append(CCFLAGS=["-g3"])
94104
else:
95105
env.Append(CCFLAGS=["-g2"])

0 commit comments

Comments
 (0)