Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDB not able to attach to a running process from VS Code while using cpptools-extension-pack & cpptools. #13123

Open
ScanderDevMode opened this issue Jan 7, 2025 · 2 comments
Assignees
Labels
bug debugger more info needed The issue report is not actionable in its current state

Comments

@ScanderDevMode
Copy link

ScanderDevMode commented Jan 7, 2025

Environment

  • OS and version: RHEL CentOS7 [Virtualbox] -> hosted on -> Windows 11
  • OS exact version -> Linux x64 3.10.0-1160.119.1.el7.x86_64 snap
  • VS Code: Code 1.96.2 (microsoft/vscode@fabdb6a, 2024-12-19T10:22:47.216Z)
  • C/C++ extension:
  • cpptools | ms- | 1.23.2
  • cpptools-extension-pack | ms- | 1.3.0
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: GDB 4.8.0

VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Linux x64 3.10.0-1160.119.1.el7.x86_64 snap
Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (7 x 0)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
webnn: unavailable_software
Load (avg) 0, 0, 0
Memory (System) 15.94GB (13.42GB free)
Process Argv --no-sandbox --crash-reporter-id 448e97e1-1932-4135-86d7-85950d4bc8b3
Screen Reader no
VM 100%
DESKTOP_SESSION 1-kde-plasma-standard
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP 1-kde-plasma-standard
XDG_SESSION_TYPE x11
Extensions (11)
Extension Author (truncated) Version
fnp2025-selective-picker FNP 0.0.1
debugpy ms- 2024.14.0
python ms- 2024.22.1
vscode-pylance ms- 2024.12.1
cmake-tools ms- 1.19.52
cpptools ms- 1.23.2
cpptools-extension-pack ms- 1.3.0
makefile-tools ms- 0.11.13
gdb-dap Ole 0.2.8
vscode-perl the 1.18.2
cmake twx 0.0.17

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc1:31192215
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624

Bug Summary and Steps to Reproduce

Bug Summary:

Hi,
While gdb works fine in the terminal [even the one inside visual code] and can attach to the running process fine, with the command 'gdb ./demo 10113' [gdb 'file' 'PID'].
It cannot be attached to a running process from Visual Studio Code.

It is starting and then closing, with no logs in the Debug console.

I am using centos7, and besides this, VS Code is running fine, and on its own, gdb is also working fine.

I may be going wrong somewhere, but I tried to dig in and found nothing.

Steps to reproduce:

  1. In this environment... Run a C++ program that has some loop or something that will keep it going for some time, or eternally. After that just try to use any suitable or preferred task.json config which will let you attach to the running process using GDB. Try using your task, and attach it to the process, it will try to attach for a very brief moment and then close automatically.
  2. With this config... No special config is needed, just use the below task.json if you want.

Help will be appreciated.
Thanks and regards,
Amit Kr Das.

Debugger Configurations

{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "/home/oswald/lab/repos/oswald_FNP_main/FNP/_output/_debug/11.19.8.0/main/Linux-x86_64-ipv6/x64_linux/demo",
"processId": "12657",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb", // Path to GDB
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"logging": {
"engineLogging": true,
"trace": true,
"traceResponse": true
}
}

Debugger Logs

No log is getting logged in the Debug Console.

Other Extensions

Extensions (11)
Extension Author (truncated) Version
fnp2025-selective-picker FNP 0.0.1
debugpy ms- 2024.14.0
python ms- 2024.22.1
vscode-pylance ms- 2024.12.1
cmake-tools ms- 1.19.52
cpptools ms- 1.23.2
cpptools-extension-pack ms- 1.3.0
makefile-tools ms- 0.11.13
gdb-dap Ole 0.2.8
vscode-perl the 1.18.2
cmake twx 0.0.17

(1 theme extensions excluded)

Additional Information

The issue was first raised in the VS Code git Repository, which was checked by Rob Lourens [email protected],
and concluded that this issue belongs to the cpptools extension, rather than VSCode itself.

The previous issue can be viewed at: microsoft/vscode#237283

@sean-mcmanus
Copy link
Contributor

@ScanderDevMode gdb attach works for me. Can you try removing "processId": "12657", and "miDebuggerPath": "/usr/bin/gdb", // Path to GDB?

@sean-mcmanus sean-mcmanus self-assigned this Jan 7, 2025
@sean-mcmanus sean-mcmanus added bug debugger more info needed The issue report is not actionable in its current state labels Jan 7, 2025
@ScanderDevMode
Copy link
Author

ScanderDevMode commented Jan 9, 2025

Hi Sean,
Thanks for the quick response.

I have already tried those things. Let me upload a small clip, giving a demo of whats going on.
I will upload it by EOD today.

Also, I can manage a screen share if you like. Let me know, if you want to.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug debugger more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

2 participants