Closed ryuukk closed 6 months ago
Does adding pub
to global
change anything? I would guess that it is getting optimized out since it's unused and not pub
.
I tried with referencing it, no luck
It's not only a Windows problem, I believe.
Even when you use it, if you make it pub or even if you export it, it makes no difference.
You can play with it here: https://godbolt.org/z/Yrocjf3T3
If you check, the C version has a little !dbg
tag that the Zig version does not have.
It's not only a Windows problem, I believe. Even when you use it, if you make it pub or even if you export it, it makes no difference. You can play with it here: https://godbolt.org/z/Yrocjf3T3 If you check, the C version has a little
!dbg
tag that the Zig version does not have.
I don't think that's because of it, D has the same problem, even thought you can see the !dbg https://godbolt.org/z/5GGz3W1To
Yeah, I think I was wrong and I apologize. Actually exporting the variable works for me on Linux, you could try that in the meantime. The problem seems to be with namespaced non-exported global variables... I can't get to inspect them with GDB.
with export
it finds the variable, but it doesn't understand what type it is:
Not fixed by #15349:
var global: i32 = 0;
pub fn main() !void {
global += 124;
}
$ gdb ./test
(gdb) break test.main
Breakpoint 1 at 0x20af48: file test.zig, line 4.
(gdb) run
Starting program: /home/andy/Downloads/zig/build-release/test
Breakpoint 1, test.main () at test.zig:4
4 global += 124;
(gdb) p 'test.global'
$1 = <optimized out>
(gdb)
Is there any progress on this? I'd like to help but I'm not really familiar with the Zig compiler infrastructure yet..
Can confirm this also happens while targeting thumb-freestanding-none and using the Cortex-Debug VSCode extension. At first I thought it could have been an extension issue but it's GDB that doesn't "see" the variable.
This is not solved for me.
This is using a default exe setup I think. Here is my tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "zig build --summary failures",
"group": "build",
"problemMatcher": [
"$gcc"
],
"presentation": {
"clear": true
}
},
]
}
and here is launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/zig-out/bin/zigtesting.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"preLaunchTask": "build"
},
]
}
Running on Windows 11 Home. builtin.zig_version
prints debug: 0.13.0
On a separate note, would it be possible to get a specific github label for bugs about missing debug information, or actually debug-related issues in general?
I would love to report more, as they are at the top of the list of Zig things we would like improved for Tides, but it's hard to know which ones are already reported (long list of issues to look through).
Are you able to see the value of hello
by hovering over it? For me using lldb a.global
is showing up as a static variable (which is incorrect but a different issue).
On a separate note, would it be possible to get a specific github label for bugs about missing debug information, or actually debug-related issues in general?
Sure!
Are you able to see the value of hello by hovering over it?
Yep!
Also it shows up if I add a watch for it. lol
however doesn't.
Zig Version
zig-windows-x86_64-0.11.0-dev.2287+1de64dba2.zip
OS: Windows 10 x64
Steps to Reproduce and Observed Behavior
break and try to inspect
global
vscode:
remedybg:
vscode launch config:
Expected Behavior
I should be able to inspect
global
in the debugger's watch menu