bytecodealliance / bytecodealliance/componentize-py

Is there a way to include debug info?

Offen
#146 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
277
Forks
51
Ø Merge
12 Std. 10 Min.
Gemergte PRs (30 T.)
10

Beschreibung

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
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, den Build-Pfad von componentize-py und die Art nachzuverfolgen, wie das generierte .wasm an Wasmtime übergeben wird, wobei WasmBacktraceDetails::Enable als Referenz für das Debugging dient. Vergleiche die verfügbaren Compile-Time-Steuerungen für Debug-Informationen in Rust und Go mit den Optionen von componentize-py und überprüfe anschließend, dass der resultierende Backtrace die ursprünglichen Quelldateien der Komponente identifiziert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, rust, wasm
Bereich
build-system, tooling
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.