'Can I debug gem5 in vs code?

I connected to my server via ssh on vs code. When I debug gem5, I use gdb to debug, but I have to display variables through commands like p var every time. Can I debug in vs code? Or is there any other way that I can display the value of the variable just by pointing at the variable with the mouse, just like debugging in visual studio?

I realize that gem5 is just a c++ executable program.
So I run it like a normal c++ program, but it doesn't stop at the breakpoint, it executes all. This problem arises:

&"warning: gdb: failed to set controlling terminal: operation not permitted\n"

I tried the solutions in this video, but none of them worked. https://www.youtube.com/watch?v=w_fpGfjAdXg&ab_channel=RoelVandePaar

I use the Code runner plugin to debug other C++ programs normally. What should I do please?



Solution 1:[1]

Adding the following changes to launch.json should help you set up gdb in vscode with Gem5. I found using GDB to be very useful to determine the call-chain and find errors.

"program": "${workspaceFolder}/build/X86/gem5.debug",
"args": ["--debug-break=<timestamp>", "${workspaceFolder}/<path to config file>"],

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 gPats