Skip to content

Make step_into({ askForTarget = true }) fall back to normal step_into() if no targets are available #1561

@Gaweringo

Description

@Gaweringo

Debug adapter definition and debug configuration

Example for rust, but also happens in C++ if there is nothing to step into (and maybe other times aswell).

      dap.adapters.codelldb = {
        type = "executable",
        command = "codelldb",
      }

      dap.configurations.rust = {
        {
          -- If you get an "Operation not permitted" error using this, try disabling YAMA:
          --  echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
          name = "Attach to process (codelldb)",
          type = 'codelldb',
          request = 'attach',
          pid = require('dap.utils').pick_process,
          args = {},
        },
      }

Debug adapter version

1.11.5

Steps to Reproduce

  1. Start a debugging session (in my case with codelldb)
  2. Use require('dap').step_into({ askForTarget = true }) to step through your program.
  3. You can't step though your program this way, since if there are no targets provided by the debug adapter, step_into does nothing in this case.

See this video for a demonstration, where normal step_into() steps into a function, but step_into({ askForTarget = true }) gets no targets from the debug adapter and thus, does not:

nvim-dap_step_into.mp4

Expected Result

That when the debug adapter does not provide any targets, the fallback is step_into(), which would then fall back to step_over().

Actual Result

If the debug adapter does not provide any targets, the message "No target selected. Not stepping" is printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions