Question about Debugging

28 views
Skip to first unread message

Dieter Weidenbrück (dweidenbrueck)

unread,
Mar 3, 2024, 5:08:20 AMMar 3
to emscripten-discuss
Hi,
I have a general question about debugging emscripten projects. I can certainly debug individual functions in Visual Studio, and I can step through functions in Chrome. However, I run into challenges:

- debugging code in Visual Studio becomes more and more impossible due to lots of interaction with WebGL and the JS side (user interface for an authoring app), so there are lots of emscripten-specific calls that won't be debuggable in VS.
- I am working with wasm workers and pthreads. Here runtime debugging is needed, however, setting breakpoints in Chrome will neither give me access to variable values, nor to an understandable call stack. All stacks end in some emscripten proxy function.
- Performance profiling in Chrome crashes every time. I've spent most of last week looking for a performance issue, but without proper profiling it turned out to be very time consuming.
- Performance profiling in Firefox gives me a result that is not really useable, because there is so much system or Firefox related information.

Don't get me wrong, I am absolutely enthusiastic about emscripten and what it can do for me, and I appreciate the challenges in providing source code debugging in a browser without knowing the real source of the code. I just smell that I may miss some kind of setting that would help me overcome the mentioned issues.

These are the settings I use:
emcc <list of .c files> -I ./include/ -g3 --source-map-base ./ -gsource-map -s ALLOW_MEMORY_GROWTH=1
-s ENVIRONMENT=web,worker --shell-file ./index_template.html -s SUPPORT_ERRNO=0 -s MODULARIZE=1 -sMALLOC=emmalloc -sWASM_WORKERS -sOFFSCREEN_FRAMEBUFFER -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -pthread -s PTHREAD_POOL_SIZE=2 -s PROXY_TO_PTHREAD=1 -s "EXPORT_NAME='wasmMod'" -s EXPORTED_FUNCTIONS="['_malloc','_free','_main']" -s EXPORTED_RUNTIME_METHODS="['cwrap','UTF16ToString','UTF8ToString','stringToUTF8','allocateUTF8','AsciiToString']" -o index.html


Any help is very much appreciated.
Thanks for all the work that you put into Emscripten!
Reply all
Reply to author
Forward
0 new messages