microsoft / microsoft/vscode-cpptools

Disable pretty-printer while populating Locals UI?

Open
#9,926 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger Feature Request
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Linux - Ubuntu 20.04
  • VS Code: 1.71.2
  • C/C++ extension: 1.12.4
  • OS and version of remote machine (if applicable): Local debug
  • GDB / LLDB version: GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Bug Summary and Steps to Reproduce

Bug Summary:

In my .gdbinit, I have a gdb pretty-printer function defined. In launch.json, pretty printing is enabled:

# (In Python mode)
gdb.pretty_printers.append(find_pp)
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },

This is fine because I see pretty prints if I dump variables via the gdb console within vscode. However, pretty printing also affects the Variables/Locals display, and this prevents me from expanding the relevant class/struct values to show the individual internal fields.

Request: vscode always disable pretty printing while it is retrieving the values to display in the Variables/Locals display, so that I can always expand values to see the actual member fields. Essentially, leave pretty printing for console commands only.

That request may make pretty printing less useful; some people may like seeing the pretty printed values in the Variables/Locals display. So perhaps:

Alternative request: vscode display the pretty printed values by default, just like it does today if pretty printing is enabled, but when the arrow that allows expanding/collapsing member fields is clicked, then temporarily disable pretty printing just while retrieving the member fields.

Debugger Configurations
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "binary_name config_name",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/_out-dev-ctr-usr-local/bin/binary_name",
            "args": [
                "a bunch of args"
            ],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}/product_name/${input:app_dir}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Enable xxx's debug commands",
                    "text": "source ${workspaceFolder}/xxx/.gdbinit" 
                },
                {
                    "description": "Set local variables; required so Jinja can process UTF-8 chars in templates.",
                    "text": "set environment LC_CTYPE C.UTF-8" 
                }
            ],
            "miDebuggerPath": "${workspaceFolder}/product_name/vscode/mi_debugger.sh"
        }
    ],
    "inputs": [
        // This requires extension spadin.memento-inputs
        // You must manually type the sub-dir name, but it remembers it next time
        {
            "id": "app_dir",
            "type": "command",
            "description": "The product_name sub-directory",
            "command": "memento.promptString",
            "args": {
                "id": "app_dir",
                "description": "The product_name sub-directory",
                "default": "some/dir",
                "placeholder": "product_name sub-dir name e.g. some/dir"
            }
        }
    ]
}
Debugger Logs
NA
Other Extensions

No response

Additional Information

No response

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

No source files, tests, or entry points are identified in the issue. Start by reproducing the behavior with GDB pretty-printing enabled and compare console output with the Variables/Locals view; done means the agreed behavior lets users inspect member fields while preserving the intended pretty-printed display.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.