Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't load lldb_commands when using codelldb #139

Closed
SlayerOfTheBad opened this issue Jan 8, 2024 · 3 comments · Fixed by #140
Closed

Don't load lldb_commands when using codelldb #139

SlayerOfTheBad opened this issue Jan 8, 2024 · 3 comments · Fixed by #140
Labels
bug Something isn't working

Comments

@SlayerOfTheBad
Copy link

Neovim version (nvim -v)

v0.10.0-dev-2042+g28c183b38c

Operating system/version

Arch Kernel: 6.6.10-lqx1-1-lqx

Output of :checkhealth rustaceanvim

==============================================================================
rustaceanvim: require("rustaceanvim.health").check()

Checking for Lua dependencies ~
- OK [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap) installed.

Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 0.3.1791-standalone
- OK Cargo: found cargo 1.75.0 (1d8b05cdd 2023-11-20)
- OK rustc: found rustc 1.75.0 (82e1608df 2023-12-21)
- OK debug adapter: found codelldb 

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

How to reproduce the issue

git clone [email protected]:SlayerOfTheBad/rustaceanvim_codelldb_minimal.git /tmp/minimal
cd /tmp/minimal
NVIM_DATA_MINIMAL=/tmp/minimal NVIM_APP_NAME="nvim-minimal" nvim -u minimal.lua
:edit foo/src/main.rs
2j
:DapToggleBreakpoint
:lua require("dapui").toggle()
:RustLsp debuggables
1

Expected behaviour

In the dap-repl window, nothing much happens, except for the startup output

Executing script: initCommands
Launching: /tmp/minimal/foo/target/debug/foo
Launched process 27248

In the Dap Scopes window, we can expand some to show the value contained within (18: i32)

Actual behaviour

In the dap-repl window, errors are thrown regarding indexing errors on a key that's equivalent to UINT32_MAX, i.e. -1.

In the Dap Scopes window, when we expand some to show the value contained within, it tells us <error: invalid value object>

The minimal config used to reproduce this issue.

See https://github.com/SlayerOfTheBad/rustaceanvim_codelldb_minimal/blob/fafe79042f8f699e8f239e3262ffd256bb5cfa96/mininal.lua
@SlayerOfTheBad SlayerOfTheBad added the bug Something isn't working label Jan 8, 2024
@SlayerOfTheBad
Copy link
Author

After a weekend of debugging why this was happening, most information of which is detailed here, I discovered the lldb_commands should only be loaded when using lldb-vscode.

codelldb has their own formatter, which conflicts with the formatter provided for lldb-vscode. Loading the lldb-vscode scripts in addition to that actively causes errors and makes it impossible to inspect Option and Result types.

We can also see that nvim-dap does not tell us to load these commands for codelldb.

In the provided repository, I have a fixed branch which shows that removing the initCommands resolves the issue. You can run this with the same commands as detailed in the replication steps to show that it generates the desired results.

@mrcjkb
Copy link
Owner

mrcjkb commented Jan 8, 2024

Hey 👋

Thanks for the detailed report!

I'm attending an unconference until January 12th, and might not have time to fix this before then 😞.

@SlayerOfTheBad
Copy link
Author

Luckily there's a fairly easy workaround as detailed in the fixed branch, so until it's fixed, people can use that. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants