gpt4 book ai didi

javascript - Webkit WASM 堆栈跟踪调试

转载 作者:行者123 更新时间:2023-11-30 07:54:21 28 4
gpt4 key购买 nike

当前,当发生 webassembly 运行时错误时,堆栈跟踪如下所示(我正在尝试将 Csound 作为 webassembly 运行)

"RuntimeError: integer result unrepresentable
at (<WASM>[5336]+20)
at (<WASM>[1557]+246)
at (<WASM>[408]+1475)
at (<WASM>[6101]+14)
at Object.Module.dynCall_ii (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:9614:89)
at invoke_ii (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:8882:32)
at (<WASM>[424]+732)
at (<WASM>[278]+45)
at Module._CsoundObj_performKsmps (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:9606:128)
at ScriptProcessorNode.audioProcessNode.onaudioprocess (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/CsoundObj.js:272:19)"

( [ number1]+ number2) 是什么意思,尤其是那些数字?

最佳答案

经过一些研究我发现格式是

(<WASM>[function_index]+offset)

要找到函数索引的相应名称,您可以使用 binaryen 的 wasm-as -s 选项生成函数索引

wasm-as libcsound.wast -s libcsound.sym -o libcsound.wasm

这是libcs​​ound.sym的内容

0:Math_pow
1:enlargeMemory
2:getTotalMemory
3:abortOnCannotGrowMemory
...

使用 libcs​​ound.sym 我们可以使用 WASM 函数名来增强示例

RuntimeError: integer result unrepresentable
at (<WASM>[5336]+20) _lrintf
at (<WASM>[1557]+246) _osckk
at (<WASM>[408]+1475) _kperf_nodebug
at (<WASM>[6101]+14) dynCall_ii
at Object.Module.dynCall_ii (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:9614:89)
at invoke_ii (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:8882:32)
at (<WASM>[424]+732) _csoundPerformKsmps
at (<WASM>[278]+45) jsCall_vi
at Module._CsoundObj_performKsmps (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:9606:128)
at ScriptProcessorNode.audioProcessNode.onaudioprocess (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/CsoundObj.js:272:19)

有趣的部分是对 lrintf 的最后一个 C 函数调用.当要转换的 float 位于长整数范围之外时,此函数可能会导致“整数结果无法表示”陷阱。我编辑了 C 代码以先检查边界,然后调用 lrint 解决了问题。

更新

当使用 -g4 并使用 Google Chrome 版本 60.0.3103.0(官方构建)金丝雀(64 位)函数名称出现在堆栈跟踪中时:

Uncaught RuntimeError: integer result unrepresentable
at _lrintf (<WASM>[4176]+6)
at _osckk (<WASM>[1291]+138)
at _kperf_nodebug (<WASM>[257]+768)
at dynCall_ii (<WASM>[4351]+13)
at Object.Module.dynCall_ii (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:9153:89)
at invoke_ii (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:8714:32)
at _csoundPerformKsmps (<WASM>[271]+558)
at _CsoundObj_performKsmps (<WASM>[131]+33)
at Module._CsoundObj_performKsmps (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/libcsound.js:9145:128)
at ScriptProcessorNode.audioProcessNode.onaudioprocess (http://192.168.2.39/~manson/emscripten/csound/emscripten/examples/javascripts/CsoundObj.js:269:19)

关于javascript - Webkit WASM 堆栈跟踪调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44047603/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com