microsoft / vscode-cpptools

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

Compound configuration with two C applications; sometimes doesn't launch both application #6431

Open ldarshan1991 opened 3 years ago

ldarshan1991 commented 3 years ago

Type: Debugger

Describe the bug

To Reproduce Please include a code sample and launch.json configuration. Steps to reproduce the behavior:

  1. Have launch configuration to launch an C application - App1
  2. Have launch configuration to launch another C application - App2
  3. Create a compound configuration to launch both of them together like -

{ "launch": { // 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", "configurations": [ { "name": "App1", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/path/to/the/executable/x86_64bi_linux-abc", "args": [ "102" ], "presentation": { "hidden": false, "group": "NonGDB", "order": 1 }, "stopAtEntry": false, "cwd": "/another/path/where/necessary/data/file/is/present", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "/path/to/gdb-8.1.2", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] }, { "name": "App2", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/path/to/the/executable/x86_64bi_linux-abc", "args": [ "102" ], "presentation": { "hidden": false, "group": "NonGDB", "order": 1 }, "stopAtEntry": false, "cwd": "/another/path/where/necessary/data/file/is/present", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "/path/to/gdb-8.1.2", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ], "compounds": [ { "name": "App1/App1", "configurations": ["App1", "App1"] } ] }


4. Now select this launch configuration - `App1/App2` and then `Run`.
5. It launches both the application in two separate integrated terminal groups. All fine.
6. Now stop the debugging for both the application.
7. After stopping the debugging, the integrated terminal groups which were created will still be there.
8. Now try launching the same configuration `App1/App2` and you see only one of the application either `App1` or `App2` would get launched.

![image](https://user-images.githubusercontent.com/28981482/97736033-1bc8e500-1b01-11eb-81f5-31fadf2cf9e1.png)

As you can see from the above picture that only one application - `App1` is launched and the other application `App2` didn't get launched.

This is an intermittent issue.

**Additional context**
*If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your `launch.json`*
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.
sean-mcmanus commented 3 years ago

@WardenGnaw I repro the bug consistently. The 1st time both apps debug. The 2nd time, one of them fails with

1: (130) LaunchOptions{"name":"gcc.exe - Build and debug active ... 1: (233) Wait for connection completion.

1: (20285) Send Event AD7MessageEvent

image

WardenGnaw commented 3 years ago

Can you share the engineLogs?

This can be done by adding

logging": { "engineLogging": true, "trace": true, "traceResponse": true }

in your launch.json

sean-mcmanus commented 3 years ago

@WardenGnaw I did the repro with those log settings and provided the logs at https://github.com/microsoft/vscode-cpptools/issues/6431#issuecomment-723236379 . Did you need more info/logs? The logs I provided are when the failure occurs.

WardenGnaw commented 3 years ago

That is not the full log since the following is not a valid launch configuration.

(130) LaunchOptions{"name":"gcc.exe - Build and debug active ...

sean-mcmanus commented 3 years ago

Ah, okay. Also, I was using trace instead of traceResponse.

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (148) LaunchOptions{\"name\":\"App2\",\"type\":\"cppdbg\",\"request\":\"launch\",\"program\":\"c:\\\test2.exe\",\"args\":[],\"stopAtEntry\":false,\"cwd\":\"C:\\",\"environment\":[],\"externalConsole\":false,\"MIMode\":\"gdb\",\"miDebuggerPath\":\"C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe\",\"setupCommands\":[{\"description\":\"Enable pretty-printing for gdb\",\"text\":\"-enable-pretty-printing\",\"ignoreFailures\":true}],\"logging\":{\"engineLogging\":true,\"traceResponse\":true},\"preLaunchTask\":\"App2\",\"configurationTarget\":5,\"sessionId\":\"48e59fb3-aff0-4ce6-95ca-b409417733f6\"}\r\n"},"seq":2} 1: (148) LaunchOptions{"name":"App2","type":"cppdbg","request":"launch","program":"c:\test2.exe","args":[],"stopAtEntry":false,"cwd":"C:\","environment":[],"externalConsole":false,"MIMode":"gdb","miDebuggerPath":"C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"logging":{"engineLogging":true,"traceResponse":true},"preLaunchTask":"App2","configurationTarget":5,"sessionId":"48e59fb3-aff0-4ce6-95ca-b409417733f6"} --> C (runInTerminal-4): {"type":"request","command":"runInTerminal","arguments":{"kind":"integrated","title":"cppdbg: test2.exe","cwd":"","args":["c:\.vscode-insiders\extensions\ms-vscode.cpptools-1.1.0\debugAdapters\bin\WindowsDebugLauncher.exe","--stdin=Microsoft-MIEngine-In-m4fk4vsf.ay4","--stdout=Microsoft-MIEngine-Out-ek15kyzf.0i3","--stderr=Microsoft-MIEngine-Error-nspv5ulq.zgh","--pid=Microsoft-MIEngine-Pid-sz5ndtre.oxe","--dbgExe=C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gdb.exe","--interpreter=mi"],"env":{}},"seq":4} --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (268) Wait for connection completion.\r\n"},"seq":6} 1: (268) Wait for connection completion. --> E (output): {"type":"event","event":"output","body":{"category":"stderr","output":"\r\n\r\n"},"seq":8}

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (20295) Send Event AD7MessageEvent\r\n"},"seq":10} 1: (20295) Send Event AD7MessageEvent --> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/MIEngine/DebuggerAborted","data":{"VS.Diagnostics.Debugger.MIEngine.DebuggerName":"GDB","VS.Diagnostics.Debugger.MIEngine.LastSentCommandName":""}},"seq":12} --> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Launch","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"16.5.11030.1","VS.Diagnostics.Debugger.HostVersion":"16.5.11030.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.ErrorCode":1005,"VS.Diagnostics.Debugger.Launch.IsError":true}},"seq":14} --> R (launch-2): {"type":"response","request_seq":2,"success":false,"command":"launch","message":"Unable to start debugging. Unable to establish a connection to GDB. Debug output may contain more information.","body":{"error":{"id":1005,"format":"Unable to start debugging. Unable to establish a connection to GDB. Debug output may contain more information."}},"seq":16}

Also, the bug doesn't repro with cppvsdbg only cppdbg.

ldarshan1991 commented 3 years ago

@WardenGnaw Have you got the necessary logs from @sean-mcmanus or do you want me to collect?

sean-mcmanus commented 3 years ago

I think the logs should be sufficient (I haven't heard otherwise). Andrew might be busy.

ldarshan1991 commented 3 years ago

okay