microsoft / microsoft/vscode-cpptools

C/C++ extension have issue on remote debugging

Aperta
#9,006 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

debugger more info needed
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Bug type: C++ Debugger

VSCode Version: 1.65.1 (user setup)
Commit: 8908a9ca0f221f36507231afb39d2d8d1e182702
Date: 2022-03-08T02:06:27.846Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042

The remote extension installed are :
C/C++ Extension Version: 1.8.4
gitlens Version: 12.0.3

I update the latest version vscode to 1.65.1 2 days ago. then I found vscode gives me the abnormal issue. My setup uses remote-ssh to connect the building machine with source code and build tool there, and locally uses vscode as IDE to compile/debugger.

Here is my launch.json file ( see below) for directly calling remote gdb and gdbserver connection cases. Both cases debugger starts and can go to some breakpoints, but at the certain breakpoint, the object address is 0x00 and stop always there, sounds like segmentation faults. However if I "run without debugger" at vscode, the program gives the right result, no crash; Also if I ssh to the building machine using putty and run gdb for the same executable file at the ssh term, everything is fine, at the same certain breakpoint, the object address is meaningful and can step into and runs fine. This is weird thing only happens on the debugger

I tried to uninstall/reinstall vscode_server at the remote system and reinstall the C/C++ extension 1.8.4, no lucky. I don't know what is reason make vscode debugger generate such weird thing. before upgrade, I can use vscode to debug the same executable.

"configurations": [
        {
            "name": "sdae driver C++ debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/wben/crpa/crpa/build/src/sdae/sdae_driver" , 
            "args": [
                "/home/wben/sdae_driver_test_data/sdae_driver_seven_elem_smi_avo.json",
                "1"
            ],
            "stopAtEntry": false,
            "cwd": "/home/wben/sdae_driver_test_data", 
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
        },        
        {
            "name": "sdae driver gdb server Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/wben/crpa/crpa/build/src/sdae/sdae_driver", 
            "args": [
                "/home/wben/sdae_driver_test_data/sdae_driver_seven_elem_smi_avo.json",
                "1"
            ],
            "stopAtEntry": true, // stop at main()
            "cwd": "/home/wben/sdae_driver_test_data", 
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb",
            "miDebuggerServerAddress": "hsv-2:2001"

I report this to vscode repo, they told me this might be C++ extension problem. (https://github.com/microsoft/vscode/issues/144798)

Here is the Output of log(extension host)

[2022-03-09 19:25:27.247] [exthost] [info] Extension host with pid 23432 started
[2022-03-09 19:25:27.247] [exthost] [info] Skipping acquiring lock for c:\Users\wben\AppData\Roaming\Code\User\workspaceStorage\61585fea964078705f0fc9fb81fb7249.
[2022-03-09 19:25:27.289] [exthost] [info] $getCanonicalURI invoked for authority (ssh-remote)
[2022-03-09 19:25:27.315] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-ssh, startup: false, activationEvent: 'onResolveRemoteAuthority:ssh-remote'
[2022-03-09 19:25:27.395] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 19:25:34.569] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.bracket-pair-colorizer, startup: true, activationEvent: '*'
[2022-03-09 19:25:34.621] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2022-03-09 19:25:35.581] [exthost] [info] Eager extensions activated
[2022-03-09 19:25:35.598] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
[2022-03-09 19:25:35.672] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'
[2022-03-09 19:25:35.688] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
[2022-03-09 19:33:23.969] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:42:21.359] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:42:32.369] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:42:44.266] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:42:56.911] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:43:09.856] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:43:22.876] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:43:35.877] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:44:08.875] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:44:41.888] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:45:14.874] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:45:47.873] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:46:20.878] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:46:53.886] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:47:26.875] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:47:59.875] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:48:32.887] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:49:05.891] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:49:38.887] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:50:11.925] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:50:44.896] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:51:19.879] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:51:52.885] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:52:25.886] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:52:58.899] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:53:34.938] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:54:08.908] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:54:42.882] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:55:15.904] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:55:48.888] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:56:21.865] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:56:54.895] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:57:27.898] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:58:00.885] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:58:33.895] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:59:06.903] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 20:59:39.905] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 21:00:12.897] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 21:00:45.884] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 21:01:19.251] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-09 21:29:00.145] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-10 08:29:33.763] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-10 08:39:56.129] [exthost] [info] extension host terminating: renderer closed the socket
[2022-03-10 08:39:56.140] [exthost] [info] Extension host with pid 23432 exiting with code 0
[2022-03-10 08:39:58.897] [exthost] [info] Extension host with pid 9836 started
[2022-03-10 08:39:58.898] [exthost] [info] Skipping acquiring lock for c:\Users\wben\AppData\Roaming\Code\User\workspaceStorage\61585fea964078705f0fc9fb81fb7249.
[2022-03-10 08:39:58.964] [exthost] [info] $getCanonicalURI invoked for authority (ssh-remote)
[2022-03-10 08:39:58.980] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-ssh, startup: false, activationEvent: 'onResolveRemoteAuthority:ssh-remote'
[2022-03-10 08:39:59.159] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-10 08:40:05.024] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.bracket-pair-colorizer, startup: true, activationEvent: '*'
[2022-03-10 08:40:05.108] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2022-03-10 08:40:06.185] [exthost] [info] Eager extensions activated
[2022-03-10 08:40:06.185] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
[2022-03-10 08:40:06.214] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
[2022-03-10 08:40:06.280] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'

Here is the Debug console output

=thread-group-added,id="i1"
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <[http://gnu.org/licenses/gpl.html>]()
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<[http://www.gnu.org/software/gdb/bugs/>]().
=cmd-param-changed,param="print pretty",value="on"
=cmd-param-changed,param="print object",value="on"
=cmd-param-changed,param="print vtbl",value="on"
=cmd-param-changed,param="demangle-style",value="gnu-v3"
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
=cmd-param-changed,param="args",value="/home/wben/sdae_driver_test_data/sdae_driver_seven_elem_smi_avo.json 1"
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
To enable execution of this file add
	add-auto-load-safe-path /usr/local/lib64/libstdc++.so.6.0.28-gdb.py
line to your configuration file "/home/wben/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/wben/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
Loaded '/opt/intel/mkl/lib/intel64/libmkl_rt.so'. Symbols loaded.
Loaded '/lib64/libpthread.so.0'. Symbols loaded.
Loaded '/usr/local/lib64/libstdc++.so.6'. Symbols loaded.
Loaded '/lib64/libm.so.6'. Symbols loaded.
Loaded '/usr/local/lib64/libgcc_s.so.1'. Symbols loaded.
Loaded '/lib64/libc.so.6'. Symbols loaded.
Loaded '/lib64/libdl.so.2'. Symbols loaded.
Execute debugger commands using "-exec <command>", for example "-exec info registers" will list registers in use (when GDB is the debugger)
The program '/home/wben/crpa/crpa/build/src/sdae/sdae_driver' has exited with code 0 (0x00000000). 

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con le due configurazioni launch.json per il debugging diretto con Remote GDB e gdbserver, quindi riproduci il comportamento dei breakpoint usando le versioni indicate di VS Code e dell’estensione C/C++. Confronta l’output di Debug Console con l’esecuzione riuscita di GDB nel terminale; il lavoro è completato quando il debugging remoto non mostra più l’indirizzo dell’oggetto non valido e non va in crash mentre lo stesso eseguibile viene eseguito correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.