bytecodealliance / bytecodealliance/componentize-py

Is there a way to include debug info?

未关闭
#146 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
279
派生
52
平均合并
12 小时 10 分钟
30 天内合并 PR
10

描述

When the .wasm file raises an error, the resulting backtrace does not contain any reference to the original source files (even using `wasmtime::WasmBacktraceDetails::Enable`).

With Rust and Go components it's possible to use compile-time flags such as `--release` or `-no-debug` to control whether debug info is included or not in the .wasm file. So I was wondering if the same would be possible with componentize-py?

Here's an example of the backtrace I get on error (where the only useful reference to my component's code is line 28):

```shell
Error: Failed to call component: error while executing at wasm backtrace:
0: 0xa9b968 - wit-component:adapter:wasi_snapshot_preview1!
1: 0x2230183 - wit-component:shim!adapt-wasi_snapshot_preview1-fd_write
2: 0x21b2244 - libc.so!__wasi_fd_write
3: 0x21b1a9f - libc.so!write
4: 0x14934 - !
5: 0xeba24e - _Py_write_impl
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/fileutils.c:1962:17 - _Py_write
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/fileutils.c:2033:12
6: 0xf9dffd - _io_FileIO_write_impl
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Modules/_io/fileio.c:874:9 - _io_FileIO_write
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Modules/_io/clinic/fileio.c.h:388:20
7: 0xd16038 - method_vectorcall_FASTCALL_KEYWORDS_METHOD
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/descrobject.c:387:24
8: 0xd09540 - _PyObject_VectorcallTstate
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Include/internal/pycore_call.h:92:11 - PyObject_VectorcallMethod
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/call.c:887:24
9: 0xfab74b - PyObject_CallMethodOneArg
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Include/cpython/abstract.h:103:12 - _textiowrapper_writeflush
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Modules/_io/textio.c:1629:15
10: 0xfacee3 - _io_TextIOWrapper_write_impl
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Modules/_io/textio.c:1759:13 - _io_TextIOWrapper_write
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Modules/_io/clinic/textio.c.h:680:20
11: 0xd64d6e - cfunction_vectorcall_O
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/methodobject.c:509:24
12: 0xd084da - _PyObject_VectorcallTstate
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Include/internal/pycore_call.h:92:11 - PyObject_CallOneArg
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/call.c:401:12
13: 0xd291f6 - PyFile_WriteObject
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/fileobject.c:132:14
14: 0xd292e5 - PyFile_WriteString
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/fileobject.c:156:15
15: 0xeab96b - _Py_WriteIndentedMargin
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/traceback.c:430:13 - _PyTraceBack_Print_Indented
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/traceback.c:1078:9
16: 0xe96e54 - print_exception_traceback
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:911:15 - print_exception
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:1180:9
17: 0xe96465 - print_exception_recursive
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:1474:13
18: 0xe96122 - _PyErr_Display
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:1524:9
19: 0xe9600c - PyErr_Display
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:1556:5
20: 0xea872d - sys_excepthook_impl
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/sysmodule.c:772:5 - sys_excepthook
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/clinic/sysmodule.c.h:102:20
21: 0xd64ea4 - cfunction_vectorcall_FASTCALL
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/methodobject.c:422:24
22: 0xd08285 - _PyObject_VectorcallTstate
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Include/internal/pycore_call.h:92:11 - _PyObject_FastCallTstate
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Include/internal/pycore_call.h:116:12 - _PyObject_FastCall
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Objects/call.c:334:12
23: 0xe94994 - _PyErr_PrintEx
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:807:28
24: 0xe96049 - PyErr_PrintEx
at /home/runner/work/componentize-py/componentize-py/cpython/builddir/wasi/../../Python/pythonrun.c:845:5
25: 0x12f52 - !
26: 0xaf3c63 - libcomponentize_py_runtime.so!pyo3::err::PyErr::print::hbb86b960398edf90
27: 0xadda83 - libcomponentize_py_runtime.so!componentize-py#Dispatch
28: 0x221c1db - libcomponentize_py_bindings.so!edgee:components/data-collection#page-export
```

贡献指南

打开贡献指南

调研方向

首先追踪 componentize-py 的构建路径,以及生成的 .wasm 如何传递给 Wasmtime,并以 WasmBacktraceDetails::Enable 作为调试参考。将 Rust 和 Go 中可用的编译时调试信息控制项与 componentize-py 的选项进行比较,然后验证生成的回溯是否能识别组件的原始源文件。

由索引模型根据 Issue 内容生成。

评估

技术栈
python, rust, wasm
领域
build-system, tooling
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。