wasi-build-debug debugging InputsOutputs.wasi.wasm using lldb14

@matt.mccormick

Hi,

I am having a lot of problems with watershed Segmentation even now with wasi build. I will explain this in my next message,

I did try to debug a wasi-build-debug of InputsOutputs.wasi.wasm module and i failed. I followed the DebugMe example and lldb-14 crashes because looking for the input files?
Command-line commands: lldb14 -- wasmtime -g run ./wasi-build-debug/InputsOutputs.wasi.wasm -- -- ./VisibleWomanHeadSlice.png ./smotthed.png
Here is the screen shot of the screen how the error happens

i get bunch of messages which i dont understand , error caused by not finding a file, which files? InputsOutputs.wasi.wasm, input image files?, i am confused and spend yesterday trying to debug it so i can move onto the watershed segmentation.

also i build it as debug build as you have mentioned in the previous message. I place following screen shots so you could investigate it

package.json file

InputsOutputs wasi-build-debug file list

Could you please write down exact command list in ubuntu starting with lldb-14, and walk me through how to continue inside the lldb-14, because inside lldb environment break points not work, run gives assertions not finding files?
please write down exact command for InputsOutputs case how to debug it with lldb-14, can you put sometime so we know and you can post it later, i need to know it now, thanks

appriciate it in advance.

p.s.: I discovered i have done a gross mistake in building wasi of watershed so that one has a problem. I believe it is related to the file format of the image VisibleWomanHeadSlice, i will explain in details in next message

BR
@sag

Hi @sag,

failed to read input file
No such file or directory

lldb14 – wasmtime -g run ./wasi-build-debug/InputsOutputs.wasi.wasm – – ./VisibleWomanHeadSlice.png ./smotthed.png

The issue here is likely a missing --dir ./ argument to wasmtime run . For example:

lldb14 – wasmtime -g run --dir ./ ./wasi-build-debug/InputsOutputs.wasi.wasm – – ./VisibleWomanHeadSlice.png ./smotthed.png

Because we are passing files that start with ./. For security reasons, WebAssembly requires explicit access to the resources it uses, including filesystem directories.

Hope this helps,
Matt

A patch to document this is here:

https://github.com/InsightSoftwareConsortium/itk-wasm/pull/820

@matt.mccormick

Hi,

thanks for the response, I will try this.

I could not respond earlier because I am involved in trying to get all the things in itk-wasm working on my ecosystem. I will try this in WASI debugging igen.
I will explain applying the itk-wasm project in browser in my next post.
wasi debugging I will try soon, still an open issue for me.

BR
@sag