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

commit feat(dap): auto-generate source map to allow stepping into std breaks non lldb debugging #40

Closed
igorlfs opened this issue Nov 1, 2023 · 8 comments · Fixed by #41
Labels
bug Something isn't working

Comments

@igorlfs
Copy link

igorlfs commented Nov 1, 2023

Neovim version (nvim -v)

v0.10.0-dev-1386+g6c87d3e0fb

Operating system/version

ArchLinux 6.5.9

Output of :checkhealth rustaceanvim

rustaceanvim: require("rustaceanvim.health").check() Checking for Lua dependencies ~ - OK mfussenegger/nvim-dap installed. Checking external dependencies ~ - OK rust-analyzer: found rust-analyzer 0.3.1713-standalone - OK Cargo: found cargo 1.73.0 - OK rustc: found rustc 1.73.0 (cc66ad468 2023-10-03) (Arch Linux rust 1:1.73.0-1) - OK lldb: found lldb version 16.0.6 Checking config ~ - OK vim.g.rustaceanvim is set - OK No errors found in config. Checking for conflicting plugins ~ - OK No conflicting plugins detected.

How to reproduce the issue

Set the debug adapter do codelldb, ie

dap = {
    adapter = {
         type = "server",
         port = "${port}",
         executable = {
            command = "codelldb",
            args = { "--port", "${port}" },
        },
    },
},

Try to launch a debug session

Expected behaviour

Debugging with codelldb should work just fine.

Actual behaviour

An error will be thrown, since codelldb doesn't support { sourceMap = source_map } (I assume)

The minimal config used to reproduce this issue.

Shouldn't go beyond the setting in the "how to reproduce" setting

@igorlfs igorlfs added the bug Something isn't working label Nov 1, 2023
@mrcjkb
Copy link
Owner

mrcjkb commented Nov 1, 2023

Hey 👋

Thanks for the detailed report!
I'll see if I can find a fix later today.

For now, you may be able to work around it by setting

vim.g.rustaceanvim = {
  dap = {
    auto_generate_source_map = false,
  }
}

It doesn't prevent a source map table from being added, but it will be empty (which might help if it's caused by an error in the source map).

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 1, 2023

🤔 according to vadimcn/codelldb#184, codelldb should be able to handle sourceMap configurations. Maybe it's something else causing the error?

Anyways, I'll disable source map generation for codelldb by default for now and will look into it in more detail later.

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 1, 2023

I think this may have to do with how the non-default config is merged with the default one.

@igorlfs
Copy link
Author

igorlfs commented Nov 1, 2023

I think this may have to do with how the non-default config is merged with the default one.

Indeed, since auto_generate_source_map = false doesn't actually change anything. By the way, is there any reason to use lldb over codelldb as the default adapter? IMHO, codelldb is wayyy cleaner when showing variables (which is arguably one of the most important features). For instance:

codelldb
image

lldb
image

(sorry for the messy code)

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 1, 2023

Indeed, since auto_generate_source_map = false doesn't actually change anything.

I think I have a fix in mind :)

is there any reason to use lldb over codelldb as the default adapter?

codelldb isn't packaged for as many distributions,. And on many distributions, you have to install it via the VSCode plugin and manually configure the paths. That makes it a lot harder to automate.

Although... I could potentially default to codelldb if it's detected on the PATH.

@mrcjkb mrcjkb mentioned this issue Nov 1, 2023
4 tasks
@mrcjkb mrcjkb closed this as completed in #41 Nov 1, 2023
@igorlfs
Copy link
Author

igorlfs commented Nov 1, 2023

I think I have a fix in mind :)

Thanks for the quick fix!

codelldb isn't packaged for as many distributions

(if we were to switch to codelldb) I'd recommend using Mason to install it (you could have that as suggestion in the README), it handles the PATH and it's pretty much painless (though it'd be an additional dependency). Any thoughts?

@mrcjkb
Copy link
Owner

mrcjkb commented Nov 2, 2023

I'd recommend using Mason to install it

I'm personally not a fan of the idea of using a Neovim plugin to manage packages, which is why I would recommend either Nix, Ansible, or the distro's package manager.

Version 3.4.0 will automatically set up a dap configuration for codelldb if it detects it on the PATH, but that's about as far as I'm willing to go regarding this plugin's responsibilities.

I do, however, plan on adding some more detailed documentation about DAP configuration: #42.

@igorlfs
Copy link
Author

igorlfs commented Nov 2, 2023

Version 3.4.0 will automatically set up a dap configuration for codelldb if it detects it on the PATH, but that's about as far as I'm willing to go regarding this plugin's responsibilities.

Nice, thanks!

You're doing a wonderful job keeping this plugin alive!

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