Pretty-printing C++ variable values in the debugger
I'm using the GLM library for vector/matrix/etc math in C++. GLM represents vec3 (and friends) as a union to allow to allow for referring fields as (x, y, z), (r, g, b) etc. This is fine, however the gdb and CodeLLDB debuggers show the unions in an awkward manner, which makes debugging a pain. See the screenshot for an example of a vec3 being displayed as three separate unions which all have to be opened to see the value.
In Xcode, I can set up some debugger pretty printing commands to simply show a formatted string instead. Is there a way to do this with VS Code's GDB or CodeLLDB debuggers? I am on linux, but have this issue on macOS as well.
Posted May 22, 2020, 10:57 PM UTC