emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

simd2.test_autodebug_wasm failure

Open juj opened this issue 3 months ago • 3 comments

Running test/runner simd2.test_autodebug_wasm fails with:

======================================================================
FAIL: test_autodebug_wasm (test_core.simd2.test_autodebug_wasm)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\emsdk\emscripten\main\test\common.py", line 919, in resulting_test
    return func(self, *args)
  File "c:\emsdk\emscripten\main\test\common.py", line 653, in metafunc
    func(self, *args, **kwargs)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\emsdk\emscripten\main\test\test_core.py", line 304, in decorated
    f(self, *args, **kwargs)
    ~^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\emsdk\emscripten\main\test\common.py", line 414, in modified
    return f(self, *args, **kwargs)
  File "c:\emsdk\emscripten\main\test\test_core.py", line 6997, in test_autodebug_wasm
    output = self.do_runf('core/test_autodebug.c', 'success')
  File "c:\emsdk\emscripten\main\test\common.py", line 1960, in do_runf
    return self._build_and_run(filename, expected_output, **kwargs)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\emsdk\emscripten\main\test\common.py", line 2008, in _build_and_run
    js_output = self.run_js(js_file, engine, args,
                            assert_returncode=assert_returncode,
                            interleaved_output=interleaved_output)
  File "c:\emsdk\emscripten\main\test\common.py", line 1588, in run_js
    self.fail('JS subprocess failed (%s): %s (expected=%s).  Output:\n%s' % (error.cmd, error.returncode, assert_returncode, ret))
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: JS subprocess failed (c:/emsdk/node/22.16.0_64bit/bin/node.exe --stack-trace-limit=50 --trace-uncaught c:\emsdk\emscripten\main\out\test\test_autodebug.js): 1 (expected=0).  Output:
failed to asynchronously prepare wasm: LinkError: WebAssembly.instantiate(): Import #13 module="env" function="get_v128": function import requires a callable
Aborted(LinkError: WebAssembly.instantiate(): Import #13 module="env" function="get_v128": function import requires a callable)
c:\emsdk\emscripten\main\out\test\test_autodebug.js:1
var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=typeof document!="undefined"?document.currentScript?.src:undefined;if(typeof __filename!="undefined"){_scriptName=__filename}else i[..]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [..]

RuntimeError: Aborted(LinkError: WebAssembly.instantiate(): Import #13 module="env" function="get_v128": function import requires a callable). Build with -sASSERTIONS for more info.
    at abort (c:\emsdk\emscripten\main\out\test\test_autodebug.js:1:3520)
    at instantiateArrayBuffer (c:\emsdk\emscripten\main\out\test\test_autodebug.js:1:4268)
    at async createWasm (c:\emsdk\emscripten\main\out\test\test_autodebug.js:1:5406)
Thrown at:
    at abort (c:\emsdk\emscripten\main\out\test\test_autodebug.js:1:3520)
    at instantiateArrayBuffer (c:\emsdk\emscripten\main\out\test\test_autodebug.js:1:4268)


Node.js v22.16.0

juj avatar Aug 21 '25 12:08 juj

I also ran into this with a project that uses -msimd128 and export EMCC_AUTODEBUG=1. I initially tried adding the get_v128 and set_v128 debug interceptors to src/lib/libautodebug.js, but then realized this wouldn't work since the v128 data type cannot be exposed to JavaScript (see e.g. issue https://github.com/WebAssembly/design/issues/1502 and comment https://github.com/emscripten-core/emscripten/issues/20414#issuecomment-1753192282).

Instead, these v128 types should probably be skipped during the InstrumentLocals pass in Binaryen.

kleisauke avatar Oct 18 '25 16:10 kleisauke

It should be possible do with a pair of i64 maybe? Not sure its worth the effort though, especially since autodebug is a very niche option.

sbc100 avatar Oct 18 '25 18:10 sbc100

Indeed, it's low priority and I just noticed that it has already been triaged (see https://github.com/emscripten-core/emscripten/pull/25002#pullrequestreview-3145683130). Sorry for the noise.

kleisauke avatar Oct 19 '25 08:10 kleisauke