@parameterized({'g': ('-g', ["src.cpp:3:12: runtime error: reference binding to null pointer of type 'int'", 'in main']), 'g4': ('-g4', ["src.cpp:3:12: runtime error: reference binding to null pointer of type 'int'", 'in main ', 'src.cpp:3:8'])})
@no_fastcomp('ubsan not supported on fastcomp')
@no_wasm2js('TODO: sanitizers in wasm2js')
def test_ubsan_full_stack_trace(self, g_flag, expected_output):
    self.emcc_args += ['-fsanitize=null', g_flag, '-s', 'ALLOW_MEMORY_GROWTH=1']
    if (g_flag == '-g4'):
        if (not self.get_setting('WASM')):
            self.skipTest('wasm2js has no source map support')
        elif ('-Oz' in self.emcc_args):
            self.skipTest('-Oz breaks stack traces')

    def modify_env(filename):
        with open(filename) as f:
            contents = f.read()
        contents = ('Module = {UBSAN_OPTIONS: "print_stacktrace=1"};' + contents)
        with open(filename, 'w') as f:
            f.write(contents)
    self.do_run(open(path_from_root('tests', 'core', 'test_ubsan_full_null_ref.cpp')).read(), post_build=modify_env, assert_all=True, expected_output=expected_output)
@parameterized({'g': ('-g', ["src.cpp:3:12: runtime error: reference binding to null pointer of type 'int'", 'in main']), 'g4': ('-g4', ["src.cpp:3:12: runtime error: reference binding to null pointer of type 'int'", 'in main ', 'src.cpp:3:8'])})
@no_fastcomp('ubsan not supported on fastcomp')
@no_wasm2js('TODO: sanitizers in wasm2js')
def test_ubsan_full_stack_trace(self, g_flag, expected_output):
    self.emcc_args += ['-fsanitize=null', g_flag, '-s', 'ALLOW_MEMORY_GROWTH=1']
    if (g_flag == '-g4'):
        if (not self.get_setting('WASM')):
            self.skipTest('wasm2js has no source map support')
        elif ('-Oz' in self.emcc_args):
            self.skipTest('-Oz breaks stack traces')

    def modify_env(filename):
        with open(filename) as f:
            contents = f.read()
        contents = ('Module = {UBSAN_OPTIONS: "print_stacktrace=1"};' + contents)
        with open(filename, 'w') as f:
            f.write(contents)
    self.do_run(open(path_from_root('tests', 'core', 'test_ubsan_full_null_ref.cpp')).read(), post_build=modify_env, assert_all=True, expected_output=expected_output)