gpt4 book ai didi

webassembly - 我如何在 chrome 上调试 wasm?

转载 作者:行者123 更新时间:2023-12-03 15:57:34 30 4
gpt4 key购买 nike

我想在 chrome 上调试 wasm 代码。

我使用“-g4”选项检查了指南构建。
我做到了,它显示了 wasm-0000~ 和如下二进制代码......

  func $stackAlloc (param i32) (result i32)
(local i32)
get_global 7
....

是否需要更多选择或我做错了什么?

提前致谢!

最佳答案

似乎在 Chrome 70 中这仍然是不可能的。不过,从 Firefox 60 开始,您可以在保留调试信息并启用源映射的情况下编译源代码。
使用保留的调试信息和基本 URL 上的源映射信息进行编译:

emcc -g4 --source-map-base http://host:port/base-path-to-source-maps-and-sources/ ...
现在复制源文件和生成的 .wasm.map--source-map-base指向的目标目录选项。您现在也可以调试源代码了。
目录布局:
$ tree # in the served directory
.
├── hellowasm.c
├── hellowasm.js
├── hellowasm.wasm
├── hellowasm.wasm.map
├── hellowasm.wast
├── index.html
└── main.js
瞧!
Screenshot: Firefox stopping in hellowasm.c
您可以在这里找到详细信息: https://web.archive.org/web/20190301201137/http://webassemblycode.com/using-browsers-debug-webassembly/ (存档内容,原域已不存在)

关于webassembly - 我如何在 chrome 上调试 wasm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49786810/

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