do not save debug info if js opts will remove it anyhow

This commit is contained in:
Alon Zakai 2014-08-13 20:39:21 -07:00
Родитель 7054468bce
Коммит 8c58c70960
2 изменённых файлов: 8 добавлений и 6 удалений

5
emcc
Просмотреть файл

@ -1456,8 +1456,9 @@ try:
# Request LLVM debug info if explicitly specified, or building bitcode with -g, or if building a source all the way to JS with -g
if debug_level >= 4 or ((final_suffix not in JS_CONTAINING_SUFFIXES or (has_source_inputs and final_suffix in JS_CONTAINING_SUFFIXES)) and requested_debug == '-g'):
newargs.append('-g') # preserve LLVM debug info
debug_level = 4
if not (final_suffix in JS_CONTAINING_SUFFIXES and js_opts): # do not save llvm debug info if js optimizer will wipe it out anyhow
newargs.append('-g') # preserve LLVM debug info
debug_level = 4
# First, generate LLVM bitcode. For each input file, we get base.o with bitcode
for i, input_file in input_files:

Просмотреть файл

@ -1940,14 +1940,15 @@ int f() {
if os.environ.get('EMCC_DEBUG'): return self.skip('cannot run in debug mode')
try:
os.environ['EMCC_DEBUG'] = '1'
# llvm debug info is kept only when we can see it, which is without the js optimize, -O0. js debug info is lost by registerize in -O2, so - g disables it
for args, expect_llvm, expect_js in [
(['-O0'], True, True),
(['-O0'], False, True),
(['-O0', '-g'], True, True),
(['-O0', '-g4'], True, True),
(['-O1'], False, True),
(['-O1', '-g'], False, True),
(['-O1', '-g'], True, True),
(['-O2'], False, False),
(['-O2', '-g'], False, True),
(['-O2', '-g'], False, True), # drop llvm debug info as js opts kill it anyway
(['-O2', '-g4'], True, True), # drop llvm debug info as js opts kill it anyway
]:
print args, expect_llvm, expect_js
output, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world.cpp')] + args, stdout=PIPE, stderr=PIPE).communicate()