itk-wasm toolchain c++ debug symbols

Hi everyone

I have a simple question about itk-wasm. Have anybody managed to build debug version of itk example into c++ using itk-wasm toolchain for both wasi/emscripten/browser?

My ecosystem is as follows:

  1. Node.js v19.xx
  2. npm v9.6.x
  3. WSL2/UBUNTU 22.04 (Docker 4.17.x)
  4. itk-wasm@1.0.0-b.94
  5. itk-image-io@1.0.0-b.94

It seems that I am unable to generate debugging c++ symbols using itk-wasm. I have looked at the itkwasm/emscripten-base:latest-debug, what does not make sense is that I see ARG CMAKE_BUILD_TYPE=Release in Dockerfile,( inside the TAG tab )? why in a debug version of the itkwasm/emscripten debug you need Release??
furthermore, in next lines I spotted ARG CMAKE_BUILD_TYPE=Debug ??
besides the only option Dockerfile has is -s ALLOW_MEMORY_GROWTH and I don’t see how other options missing. One needs to do some changes like minimum memory for wasm, max memory, -s WASM=1, -s export methods,and so forth,
can I add those in the command line as I use itk-wasm or inside the CMakeLists.txt file? like below
itk-wasm -b dir itkwasm/emscripten:latest-debug -s WASM=1 -o some.html, -g -fdebug-compilation-dir='..' , IS IT POSSIBLE TO DO THAT?

I want to export functions from final wasm file and use it for passing some arguments or do something with it? I cannot seem to have any way to do that from command line. it think that the reason itk-wasm does not generate c++ symbolic under DWARF support enabled could be missing options, any ideas welcomed specially from staff who wrote the Dockerfile to build itk into the itk-wasm.

I built a c++ program without itk-wasm toolchain using emcc/em++ and it worked, I could step into c++ code in the devtools and it was okay. what is it I am doing wrong, I followed all the instruction @matt.mccormick in Debugging tutorial and still I am not able to step into c++ code, most of the time c++ code is not found in devtools even though I setup path substitution according to the instructions provided in tutorials. Please acknowledge I could have complete debugging experience using emcc/em++ with proper options to generate .html, .js, .wasm file in the build directory.

the following is how I build debug version of emscripten build for my itk application, any example you pick:
itk-wasm -I itkwasm/emscripten:latest-debug --build-dir emscripten-build-debug build -- -DCMAKE_BUILD_TYPE=Debug

I am not sure if I want to use emcc/em++ so I could get every ITK dependencies right and consequently build the my version of itk-wasm?

I already appreciate you help

BR
@sag

Hi @sag,

To confirm,

generate c++ symbolic under DWARF support enabled could be missing options

The -debug Docker images do contain ITK builds with debugging symbols.

itk-wasm -I itkwasm/emscripten:latest-debug --build-dir emscripten-build-debug build – -DCMAKE_BUILD_TYPE=Debug

Yes, adding -DCMAKE_BUILD_TYPE=Debug will also include debug versions in your generated wasm binary.

This is necessary to get the debugging experience in Chromium as documented in the debugging tutorial. Very recent versions of Chromium enabled the debugging support by default in DevTools, but I believe you still need to install and configure the associated extension.