-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Description
Related: microsoft/vscode-cpptools#14118
Environment
- OS and version: Windows 10
- VS Code: 1.107.1
- C/C++ extension: 1.29.3
- OS and version of remote machine (if applicable): RHEL 8
- GDB / LLDB version: 16.3
Bug Summary and Steps to Reproduce
Bug Summary:
When using attach mode, vscode cppdbg should not start a new terminal. The terminal is always empty and useless.
Steps to reproduce:
-
Install
C/C++extension andTasks Shell Inputextension. -
launch.json:{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Attach", "type": "cppdbg", "request": "attach", "program": "${workspaceFolder}/main", "processId": "${input:processID}", "MIMode": "gdb" } ], "inputs": [ { "id": "processID", "type": "command", "command": "shellCommand.execute", "args": { "command": "cat ${workspaceFolder}/main.pid", "useFirstResult": true } } ] } -
main.c:#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { FILE *fp = fopen("main.pid", "w"); if (!fp) { return EXIT_FAILURE; } fprintf(fp, "%ld\n", (long) getpid()); fclose(fp); while (1) { puts("Hello"); sleep(3); } return EXIT_SUCCESS; }
-
Compile and run:
gcc -g main.c -o main
./main
-
Run - Start Debugging
We need the "attach" mode because the actual program need a special way to launch.
But in "attach" mode, the terminal "cppdbg: main" is useless (and distracting). It will always be empty, because the program prints and reads at its own terminal.
Maybe cppdbg should not launch a terminal when using attach mode, or we need an option at launch.json to make cppdbg not to launch a terminal.
Metadata
Metadata
Assignees
Labels
No labels