#Not possible to watching global variables on Debug VSCode

1 messages · Page 1 of 1 (latest)

rigid cape
#

Hi there, I am trying to debug some global values and it looks like impossible using GDB, I can access local variables not not globals.
If anyone know how to fix it, let me know.

    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/zig-out/bin/space_researcher",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "preLaunchTask": "build",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}```
uneven vale
#

Consider that in Zig the file is a struct, so file-level vars are members of that struct.

rigid cape
round cliff
rigid cape
uneven vale
#

Files are structs, with the name being the filename, so I would suspect if you use file.var it would resolve. Maybe

rigid cape
#

Hi there, the lldb worked for me, thanks all

rigid cape
#

Hi @round cliff , sorry to ping you again on this topic, I just updated zig from 0.14.1 to 0.15.1 and the lldb just stop showing variables, local and global, do you know any workaround?
Thanks in advance.

#

I think I found it, I set .use_llvm = true, on the executable and it works now 😮

round cliff
#

yep on linux use_llvm will do
on windows its fully broken thought