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

**URL:** https://discourse.itk.org/t/wasi-build-debug-debugging-inputsoutputs-wasi-wasm-using-lldb14/5897
**Category:** Engineering
**Tags:** itk-wasm
**Created:** [April 26, 2023, 10:21am UTC](https://discourse.itk.org/t/wasi-build-debug-debugging-inputsoutputs-wasi-wasm-using-lldb14/5897 "2023-04-26T10:21:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sag](https://discourse.itk.org/user_avatar/discourse.itk.org/sag/32/2041_2.png) [@sag](https://discourse.itk.org/u/sag)
#### Post date: [April 26, 2023, 10:21am UTC](https://discourse.itk.org/t/wasi-build-debug-debugging-inputsoutputs-wasi-wasm-using-lldb14/5897/1 "2023-04-26T10:21:07Z")

</div>

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

 ![InputsOutputs-wasi-wasm-debug](https://discourse.itk.org/uploads/default/original/2X/d/de2584b983c309d002b987e223546df2f464890a.png)

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-package-json](https://discourse.itk.org/uploads/default/original/2X/f/f5f9ddb2a48a615a049f44a04eecc69f742ad988.png)

`InputsOutputs wasi-build-debug file list`

 ![InputOutputs-wasi-build-debug-file-list](https://discourse.itk.org/uploads/default/original/2X/8/841bd10ad5f364afa90caa496d622ccccbb504cb.png)

`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

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [May 1, 2023, 9:15pm UTC](https://discourse.itk.org/t/wasi-build-debug-debugging-inputsoutputs-wasi-wasm-using-lldb14/5897/2 "2023-05-01T21:15:28Z")

</div>

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

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [May 2, 2023, 3:11pm UTC](https://discourse.itk.org/t/wasi-build-debug-debugging-inputsoutputs-wasi-wasm-using-lldb14/5897/3 "2023-05-02T15:11:48Z")

</div>

A patch to document this is here:

[https://github.com/InsightSoftwareConsortium/itk-wasm/pull/820](https://github.com/InsightSoftwareConsortium/itk-wasm/pull/820)

---

<div class="post-metadata">

### Author: ![sag](https://discourse.itk.org/user_avatar/discourse.itk.org/sag/32/2041_2.png) [@sag](https://discourse.itk.org/u/sag)
#### Post date: [May 9, 2023, 9:43am UTC](https://discourse.itk.org/t/wasi-build-debug-debugging-inputsoutputs-wasi-wasm-using-lldb14/5897/4 "2023-05-09T09:43:07Z")

</div>

@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
