How to see global variables?
If submitting a bug please make sure
- [x] If you are using gdb
- [x]
gdb --version>= 7.7.1 - [x] it works on the command line with
gdb - [x]
cwdandtargetare properly set
- [x]
- [ ] If you are using lldb
- [ ]
lldb --version>= 3.7.1 - [ ] it works on the command line with
lldb-mi - [ ]
cwdandtargetare properly set
- [ ]
Screenshots are helpful but not required
I'm using vscode on Windows with the MingW toolset to write and debug Fortran code. I have gdb 8.1 and gfortran 8.1.
I got some global variables declared in a module and used in other modules. The variables are not shown in the variables list (of course, it's showing local variables only). I can show them by print in the gdb console, and i can also add them to the watch list. But the watch list is not displaying the same way, making it hard to read.
In watch:
in variable list:

UPDATE: I just tried the Microsoft c/c++ ext. In watch list, it's also showing the same way as in the variable list. I'm switching to that before i get a solution with this ext.
there is no GDB MI command to list all variables. There has been one in version 5, but it seems to have been removed. There are too many globals in a program and the non-MI command info variables just lists their name and address so there would need to be some sort of lazy loading of values.
So this can't be implemented right now because there is no support for it in the debuggers.
@WebFreak001 Thank you for the reply. The microsoft c/c++ extension display the same variable in watch list as
which I think looks better. Is this something achievable?
uhh probably but I didn't really write it to be possible like that from the start so it would be difficult to make this work too I think
haven't touched the repo for a while