question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

variables are not being shown in VSCode but GDB is showing them

See original GitHub issue

the setup is:

  • VSCode running on Windows
  • GDB running on linux
  • the ssh extension is being used
  • process is C/C++

The members of a struct are shown in the variable list but they have no value.

I captured the log of the DAP communication and I can see that the variables are being requested and returned empty:

for example:

{
  "type": "response",
  "request_seq": 58,
  "success": true,
  "command": "variables",
  "body": {
    "variables": [
      {
        "name": "next",
        "value": "",
        "type": "struct cdbtype_ *",
        "evaluateName": "((cdbtype *)0x7408b2eaa3e8)->next",
        "variablesReference": 1012
      },
      {
        "name": "pif_type",
        "value": "",
        "type": "enum pif_types_",
        "evaluateName": "((cdbtype *)0x7408b2eaa3e8)->pif_type",
        "variablesReference": 0
      },

If I check the variables inside GDB I can see their value correctly. Given the DAP shows empty strings I believe the problem might be in OpenDebugAD7.

Happy to collect more info if needed.

Issue Analytics

  • State:closed
  • Created a month ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chimicuscommented, Aug 10, 2023

Agreed, thanks - I think this can be closed

0reactions
WardenGnawcommented, Aug 9, 2023

and I can see that GDB in MI mode is reporting those variables as empy… this is disappointing… it looks like a GDB bug

Yep. I believe this would have to be filed at https://sourceware.org/bugzilla/ in order for this to be fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My VSCode debugger dosen't show any variable value ...
The c++ debugger dosen't show any values which are readable. ... Variable not showing their values during debugging. my launch.json:
Read more >
debugger not showing variables and callstack #51
Debugging works, but no local variables. The debugger is getting them because i can hover over variables in the code and see their...
Read more >
Configure launch.json for C/C++ debugging in ...
The path to the debugger (such as gdb). When only the executable is specified, it will search the operating system's PATH variable for...
Read more >
Get Started with C++ and MinGW-w64 in Visual Studio Code
Using GCC with MinGW. In this tutorial, you configure Visual Studio Code to use the GCC C++ compiler (g++) and GDB debugger from...
Read more >
Debugger Extension
Variable values shown in hovers or inlined in the source. ... It is called Mock Debug because it does not talk to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found