Closed selvavm closed 3 years ago
Please see lldb formatters docs.
Hey,
I wanted to add my solution to this thread, because it was quite frustrating getting this work with lldb
.
For Linux (in my case an Arch WSL2 system) I found that lldb
worked very nicely for debugging Rust, so I wanted to stay with lldb
.
So with all of that out of the way... my solution was: NOTE: This is a Linux based (Arch WSL2) solution
CodeLLDB
VSCode extension. ndarray
Arrays looks like this
then you have the default "representation" using lldb
settings.json
for VSCode add the lines:
"lldb.launch.initCommands": [
"command script import ${workspaceFolder}/.vscode/name_of_ndarray_format.py"
],
with name_of_ndarray_format.py
being the file that I will descripe now:
${workspaceFolder}/.vscode/
, you should be able to start a debug session with lldb
and should instead see the ndarray ArrayBase types
as:
which is the desired output we want to see in a debugger. NOTE: I have very limited knowledge about lldb
and its innerworkings and I do not provide any warranty for my solution. This was the final solution, which worked for me and wanted to share it, so maybe more people can profit from this.
I also left this answer on: https://github.com/rust-ndarray/ndarray/issues/827
OS: Windows 8.1 VSCode version: 1.49 Extension version: 0.2.313 Toolchain version: stable-x86_64-pc-windows-msvc Build target: stable-x86_64-pc-windows-msvc Python version:
I am building a rust application and it has lot of 1D and 2D NdArray. I wanted to visualise them in VSCode while debugging but it is showing only pointer. I see that you have a formatter/rust.py and you have defined visualisation for Rust types. I am not an expert in python (and rust as well), so don't know how to define this type. Can you provide some code hints on how to modify?