microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

C/C++ extension have issue on remote debugging #9006

Open bwcc60 opened 2 years ago

bwcc60 commented 2 years ago

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). 
WardenGnaw commented 2 years ago

Can you provide additional logs by adding the following to your launch.json? "logging": { "engineLogging": true, "trace": true, "traceResponse": true }

bwcc60 commented 2 years ago

Here is the logs after changing the launch.json and restart vscode and run a complete debug session with weird issue.

log Extension Host

[2022-03-10 11:23:16.488] [exthost] [info] Extension host with pid 14732 started
[2022-03-10 11:23:16.489] [exthost] [info] Skipping acquiring lock for c:\Users\wben\AppData\Roaming\Code\User\workspaceStorage\61585fea964078705f0fc9fb81fb7249.
[2022-03-10 11:23:16.537] [exthost] [info] $getCanonicalURI invoked for authority (ssh-remote)
[2022-03-10 11:23:16.571] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-ssh, startup: false, activationEvent: 'onResolveRemoteAuthority:ssh-remote'
[2022-03-10 11:23:16.665] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote)
[2022-03-10 11:23:23.582] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.bracket-pair-colorizer, startup: true, activationEvent: '*'
[2022-03-10 11:23:23.638] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
[2022-03-10 11:23:25.175] [exthost] [info] Eager extensions activated
[2022-03-10 11:23:25.184] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
[2022-03-10 11:23:25.264] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished'
[2022-03-10 11:23:25.327] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'

log ( Window)

[2022-03-10 13:47:08.652] [renderer4] [info] Invoking resolveAuthority(ssh-remote)
[2022-03-10 13:47:10.718] [renderer4] [error] [Extension Host] (node:17476) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
[2022-03-10 13:47:10.738] [renderer4] [info] resolveAuthority(ssh-remote) returned '127.0.0.1:1085' after 2086 ms
[2022-03-10 13:47:14.215] [renderer4] [error] Could not find pty on pty host: Error: Could not find pty on pty host
    at o._throwIfNoPty (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:17:5354)
    at o.updateTitle (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:17:1694)
    at Object.call (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:13:8348)
    at L.onPromise (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:12:4866)
    at L.onRawMessage (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:12:4261)
    at /home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:12:3553
    at a.invoke (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:8:145)
    at I.fire (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:8:1856)
    at process.f (/home/wben/.vscode-server/bin/8908a9ca0f221f36507231afb39d2d8d1e182702/out/vs/platform/terminal/node/ptyHostMain.js:6:34341)
    at process.emit (events.js:315:20)
    at emit (internal/child_process.js:903:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
[2022-03-10 13:47:16.383] [renderer4] [error] [Extension Host] (node:101487) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

log(Main)

[2022-03-10 11:23:13.821] [main] [info] window#load: attempt to load window (id: 1)
[2022-03-10 11:23:13.865] [main] [info] update#setState idle
[2022-03-10 11:23:13.954] [main] [info] ExtensionHostStarterWorker created
[2022-03-10 11:23:15.480] [main] [info] window#load: window reported ready (id: 1)
[2022-03-10 11:23:15.742] [main] [info] Starting extension host with pid 14732 (fork() took 29 ms).
[2022-03-10 11:23:15.743] [main] [info] ExtensionHostStarterWorker.start() took 31 ms.
[2022-03-10 11:23:43.877] [main] [info] update#setState checking for updates
[2022-03-10 11:23:43.976] [main] [info] update#setState idle
[2022-03-10 12:23:43.877] [main] [info] update#setState checking for updates
[2022-03-10 12:23:44.400] [main] [info] update#setState idle
[2022-03-10 13:17:05.319] [main] [info] window#load: attempt to load window (id: 3)
[2022-03-10 13:17:06.867] [main] [info] window#load: window reported ready (id: 3)
[2022-03-10 13:17:07.070] [main] [info] Starting extension host with pid 24888 (fork() took 22 ms).
[2022-03-10 13:17:07.070] [main] [info] ExtensionHostStarterWorker.start() took 24 ms.
[2022-03-10 13:23:43.886] [main] [info] update#setState checking for updates
[2022-03-10 13:23:44.358] [main] [info] update#setState idle

log(Shared)

[2022-03-10 11:23:18.366] [sharedprocess] [info] Starting worker process with pid 21384 (type: fileWatcher, window: 1).
[2022-03-10 13:17:08.345] [sharedprocess] [info] Starting worker process with pid 18572 (type: fileWatcher, window: 3).
[2022-03-10 13:46:55.510] [sharedprocess] [info] Worker process with pid 21384 terminated normally (type: fileWatcher, window: 1).
[2022-03-10 13:47:08.818] [sharedprocess] [info] Starting worker process with pid 28480 (type: fileWatcher, window: 4).

log(Settings Sync)

[2022-03-10 11:23:17.686] [settingssync] [info] Using settings sync service https://vscode-sync.trafficmanager.net/
[2022-03-10 11:23:17.686] [settingssync] [info] Auto Sync is disabled.

log(Remove Server)

[2022-03-10 08:40:02.367] [remoteagent] [info] Extension host agent started.
[2022-03-10 08:40:02.677] [remoteagent] [info] [127.0.0.1][91608fc4][ManagementConnection] New connection established.
[2022-03-10 08:40:02.713] [remoteagent] [info] [127.0.0.1][65b4c8b6][ExtensionHostConnection] New connection established.
[2022-03-10 08:40:02.721] [remoteagent] [info] [127.0.0.1][65b4c8b6][ExtensionHostConnection] <85515> Launched Extension Host Process.
[2022-03-10 08:40:08.462] [remoteagent] [info] Getting Manifest... eamodio.gitlens
[2022-03-10 08:40:08.650] [remoteagent] [error] Failed to install extension. eamodio.gitlens
[2022-03-10 08:40:08.654] [remoteagent] [error] Error: self signed certificate in certificate chain
    at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:932:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
[2022-03-10 08:40:27.006] [remoteagent] [info] Installing extension: eamodio.gitlens
[2022-03-10 08:40:27.007] [remoteagent] [info] Installing the extension without checking dependencies and pack eamodio.gitlens
[2022-03-10 08:40:27.858] [remoteagent] [info] Extracted extension to /home/wben/.vscode-server/extensions/.931f5f33-6c8a-4f04-8bbb-a8ba8be53d56: eamodio.gitlens
[2022-03-10 08:40:27.885] [remoteagent] [info] Renamed to /home/wben/.vscode-server/extensions/eamodio.gitlens-12.0.3
[2022-03-10 08:40:27.893] [remoteagent] [info] Extracting completed. eamodio.gitlens
[2022-03-10 08:40:27.894] [remoteagent] [info] Extension installed successfully: eamodio.gitlens
[2022-03-10 10:31:26.570] [remoteagent] [info] [127.0.0.1][91608fc4][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2022-03-10 10:31:26.841] [remoteagent] [info] [127.0.0.1][65b4c8b6][ExtensionHostConnection] <85515> Extension Host Process exited with code: 0, signal: null.
[2022-03-10 10:31:26.841] [remoteagent] [info] Last EH closed, waiting before shutting down
[2022-03-10 10:31:42.713] [remoteagent] [info] Got delay-shutdown request while in shutdown timeout, delaying
[2022-03-10 10:31:42.713] [remoteagent] [info] Cancelling previous shutdown timeout
[2022-03-10 10:31:43.136] [remoteagent] [info] [127.0.0.1][06abb6a1][ManagementConnection] New connection established.
[2022-03-10 10:31:43.221] [remoteagent] [info] [127.0.0.1][3ab78c8a][ExtensionHostConnection] New connection established.
[2022-03-10 10:31:43.233] [remoteagent] [info] [127.0.0.1][3ab78c8a][ExtensionHostConnection] <91034> Launched Extension Host Process.
[2022-03-10 10:36:42.716] [remoteagent] [info] New EH opened, aborting shutdown
[2022-03-10 11:23:01.010] [remoteagent] [info] [127.0.0.1][06abb6a1][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2022-03-10 11:23:01.199] [remoteagent] [info] [127.0.0.1][3ab78c8a][ExtensionHostConnection] <91034> Extension Host Process exited with code: 0, signal: null.
[2022-03-10 11:23:01.200] [remoteagent] [info] Last EH closed, waiting before shutting down
[2022-03-10 11:23:19.690] [remoteagent] [info] Got delay-shutdown request while in shutdown timeout, delaying
[2022-03-10 11:23:19.690] [remoteagent] [info] Cancelling previous shutdown timeout
[2022-03-10 11:23:20.213] [remoteagent] [info] [127.0.0.1][f44b941f][ManagementConnection] New connection established.
[2022-03-10 11:23:20.312] [remoteagent] [info] [127.0.0.1][5520335f][ExtensionHostConnection] New connection established.
[2022-03-10 11:23:20.321] [remoteagent] [info] [127.0.0.1][5520335f][ExtensionHostConnection] <95353> Launched Extension Host Process.
[2022-03-10 11:28:19.692] [remoteagent] [info] New EH opened, aborting shutdown
[2022-03-10 13:17:11.224] [remoteagent] [info] [127.0.0.1][bd7fde09][ManagementConnection] New connection established.
[2022-03-10 13:17:11.353] [remoteagent] [info] [127.0.0.1][a9fd62d1][ExtensionHostConnection] New connection established.
[2022-03-10 13:17:11.383] [remoteagent] [info] [127.0.0.1][a9fd62d1][ExtensionHostConnection] <100406> Launched Extension Host Process.
[2022-03-10 13:46:55.410] [remoteagent] [info] [127.0.0.1][f44b941f][ManagementConnection] The client has disconnected gracefully, so the connection will be disposed.
[2022-03-10 13:46:55.649] [remoteagent] [info] [127.0.0.1][5520335f][ExtensionHostConnection] <95353> Extension Host Process exited with code: 0, signal: null.
[2022-03-10 13:47:10.964] [remoteagent] [info] [127.0.0.1][24d7b32e][ManagementConnection] New connection established.
[2022-03-10 13:47:11.166] [remoteagent] [info] [127.0.0.1][6a0c2cd6][ExtensionHostConnection] New connection established.
[2022-03-10 13:47:11.183] [remoteagent] [info] [127.0.0.1][6a0c2cd6][ExtensionHostConnection] <101487> Launched Extension Host Process.

log(Remote Extension)

[2022-03-10 13:47:14.278] [exthost] [info] Extension host with pid 101487 started
[2022-03-10 13:47:14.287] [exthost] [info] Lock '/home/wben/.vscode-server/data/User/workspaceStorage/61585fea964078705f0fc9fb81fb7249/vscode.lock': Lock acquired.
[2022-03-10 13:47:15.408] [exthost] [info] ExtensionService#_doActivateExtension cschlosser.doxdocgen, startup: false, activationEvent: 'onLanguage:cpp'
[2022-03-10 13:47:15.487] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.cpptools, startup: false, activationEvent: 'onLanguage:cpp'
[2022-03-10 13:47:15.661] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '*'
[2022-03-10 13:47:15.666] [exthost] [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.github
[2022-03-10 13:47:15.671] [exthost] [info] ExtensionService#_doActivateExtension vscode.ipynb, startup: true, activationEvent: '*'
[2022-03-10 13:47:15.920] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
[2022-03-10 13:47:16.020] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
[2022-03-10 13:47:16.707] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.cmake-tools, startup: true, activationEvent: 'workspaceContains:*/CMakeLists.txt,*/*/CMakeLists.txt,*/*/*/CMakeLists.txt'
[2022-03-10 13:47:18.896] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished'
[2022-03-10 13:47:18.921] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
[2022-03-10 13:47:18.927] [exthost] [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
[2022-03-10 13:47:19.151] [exthost] [info] Eager extensions activated
[2022-03-10 13:47:25.757] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-server-ready, startup: false, activationEvent: 'onDebugResolve'
[2022-03-10 13:47:31.811] [exthost] [warning] TextEditor is closed/disposed
WardenGnaw commented 2 years ago

Sorry, can you provide the ones in Debug Console?

bwcc60 commented 2 years ago

Debug Console

=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".
Loaded '/opt/intel/mkl/lib/intel64/libmkl_rt.so'. Symbols loaded.
Loaded '/lib64/libpthread.so.0'. Symbols loaded.
Loaded '/lib64/libstdc++.so.6'. Symbols loaded.
Loaded '/lib64/libm.so.6'. Symbols loaded.
Loaded '/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).

gcc 4.8.5 to compile

WardenGnaw commented 2 years ago

Those logs do not seem to have engine logging enabled. Please double check the launch configuration you are using includes "logging": { "engineLogging": true, "trace": true, "traceResponse": true }

bwcc60 commented 2 years ago

I put logging setting on the launch.json file. is it the right place?

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "logging": { "engineLogging": true, "trace": true, "traceResponse": true },
    "configurations": [
        {
            "name": "sdae driver C++ debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/wben/crpa/crpa/build/src/sdae/sdae_driver" , // ${workspaceFolder}/build/src/sdae/sdae_driver", // ${fileDirname}/${fileBasenameNoExtension}", //"enter program name, for example ${workspaceFolder}/a.out",
            "args": [
                "/home/wben/sdae_driver_test_data/sdae_driver_seven_elem_smi_avo.json",
                "1"
            ],
            "stopAtEntry": false,
            "cwd": "/home/wben/sdae_driver_test_data", // "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"

        },        

}
bwcc60 commented 2 years ago

vscode_debugger_output.txt

weird thing happens at line 210. wc is a unique pointer to the base class object, wc->somefunction(), before "->", wc has the right value, but when enter "somefunction(), the "this" pointer is 0x0 value.

WardenGnaw commented 2 years ago

The debugger is getting a Segfault as indicated when you said the pointer is 0x0 and is causing the process to shutdown which ends the debug session.

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (20427) ->*stopped,reason=\"exited-signalled\",signal-name=\"SIGSEGV\",signal-meaning=\"Segmentation fault\"\n"},"seq":2890}
1: (20427) ->*stopped,reason="exited-signalled",signal-name="SIGSEGV",signal-meaning="Segmentation fault"

Are you able to provide a sample project that reproduces this issue? If you can't, can you see if you can reproduce this in GDB CLI?

bwcc60 commented 2 years ago

the GDB CLI does not show this error. it runs well, also if I run the program without debug at vscode, it is also doing well. Also I notice that the wc shows 0x00, because it points to different object. I highly suspect that result that vscode debugger returns is no the right type of object. ,

rickstaa commented 2 years ago

Experiencing this issue on:

Version: 1.65.2
Commit: c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1
Date: 2022-03-10T15:36:26.048Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.13.0-35-generic

I often when debugging get a segmentation fault when I'm using the attach option.