rust-lang / rust-lang/rust-analyzer

GDB pretty printing not enabled by default in VSCode when using `ms-vscode.cpptools` debugger

Open
#20,505 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

When trying to debug in VSCode on Ubuntu with GNU gdb (Ubuntu 16.2-8ubuntu1) 16.2 I wasn't able to see nice printouts in the variables pane or debug panel.

For example a String just shows the raw underlying Vec

Image

Thanks to this thread:

https://users.rust-lang.org/t/vscode-gdb-rust-analyzer-pretty-printing/73705

I was able to get things working by following OP's tip on including the VSCode settings

{
  "rust-analyzer.debug.engine": "ms-vscode.cpptools",
  "rust-analyzer.debug.engineSettings": {
    "cppdbg": {
      "miDebuggerPath": "${env:HOME}/.cargo/bin/rust-gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": false
        }
      ]
    }
  }
}

Could these be enabled by default so everyone can easily see your great GDB integration?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the rust-analyzer.debug.engine and rust-analyzer.debug.engineSettings configuration for the ms-vscode.cpptools debugger. Compare the supplied cppdbg setupCommands with the existing defaults, then check the relevant debugger integration tests if available. Done means Rust debugging enables GDB pretty-printing by default without requiring those user settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, ubuntu, vscode
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.