microsoft / microsoft/vscode-cpptools

Pretty Print not working

Open
#8,485 11 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug type: Debugger

-GDB version: 9.2 (installed using "apt install gdb")

  • OS and Version: wsl ubuntu 20.04 running on windows 10
  • VS Code Version: 1.62.3
  • C/C++ Extension Version: v1.8.0-insiders
  • A clear and concise description of what the bug is.

Description: Char arrays in c are not pretty-printed in vscode sidebar, but are pretty-printed when calling -exec info locals in the Debug Console (see at bottom of image).

Screenshot demonstrating error:
temp

To Reproduce
launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "clang - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: clang build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

tasks.json:

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: clang build active file",
			"command": "/usr/bin/clang",
			"args": [
				"-fdiagnostics-color=always",
				"-g",
				"${file}",
				"-o",
				"${fileDirname}/${fileBasenameNoExtension}"
			],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "compiler: /usr/bin/clang"
		}
	]
}

main.c:

int main() {
    char str[5] = "test";

    return 0;
}

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 reproducing the sidebar behavior with main.c, launch.json, and tasks.json under the reported GDB, WSL Ubuntu, and VS Code versions. Compare the sidebar with the Debug Console's -exec info locals; done means the char array is displayed consistently in the sidebar as well.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.