MIEngine: Entire struct not displayed in debugger

Working with the glm library, struct contents are being partially displayed by gdb. This is a gist of what glm::tvec2 looks like…

template<typename T>
struct tvec2
{
    union {T x, r, s;};
    union {T y, g, t;};
}

This is what is shown in the debugger… locals

My launch.json file is

"version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) App",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/build/<app_name>",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "linux": {
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/bin/gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            }
        }
    ]

Here are my system details:

Ubuntu 18.04
gcc v7.3.0
gdb v8.1.0
VSCode 1.30.2
ms-vscode.cpptools v0.20.1

How do I get the debugger to display the entire contents of the struct? In the image shown, minEdgePoint and maxEdgePoint do not display the union with y,g,t values.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

@pieandcakes I am getting this error using the GLM natvis file provided inside the glm repo. I appreciate this is closed and from 2019 but its the most relevant and only exact result online for this issue. I am using the exact same natvis file for my msvc debugger launch and it works flawlessly.

I am launching via the below launch.json using the GDB debugger and the Cmake extension.

Version/Extension:

VScode v1.94.2
C/C++ v1.22.9
CMake v0.0.17
CMake Tools v1.19.52
GNU gdb (GDB) 13.1

launch.json:

{
	"version": "0.2.0",
	"configurations": [
            {
			"name": "(gdb) Launch",
			"type": "cppdbg",
			"request": "launch",
			"program": "${command:cmake.launchTargetPath}", // Resolved by CMake Tools:
			"args": [],
			"stopAtEntry": false,
			"cwd": "${workspaceFolder}",
			"environment": [ { "name": "PATH", "value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}" } ],
			"externalConsole": true,
			"MIMode": "gdb",
			"logging": { "natvisDiagnostics": "verbose", },
			"visualizerFile": "${workspaceFolder}/.vscode/glm.natvis",
			"showDisplayString": true,
			"setupCommands": [
				{
					"description": "Enable pretty-printing for gdb",
					"text": "-enable-pretty-printing",
					"ignoreFailures": true
				}
			]
		}
	]
}

I can provide the GLM natvis but its as-provided in the repo here

Debug console in VS prints below when I expand a vec3:

[Natvis] [Error] Natvis failed to parse typename: union {...}
[Natvis] [Error] Natvis failed to parse typename: union {...}
[Natvis] [Error] Natvis failed to parse typename: union {...}