Skip to content

Instantly share code, notes, and snippets.

@FabioGNR
Last active February 22, 2023 13:03
Show Gist options
  • Save FabioGNR/42a2f1c18e4c5820022f5f7242e978d7 to your computer and use it in GitHub Desktop.
Save FabioGNR/42a2f1c18e4c5820022f5f7242e978d7 to your computer and use it in GitHub Desktop.
vscode cpp remote dbg interrupt
{
// 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": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/test_app",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"miDebuggerServerAddress": "127.0.0.1:1234",
"miDebuggerArgs": "-q",
"serverLaunchTimeout": 1000,
"MIMode": "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
}
],
"preLaunchTask": "gdbserver"
}
]
}
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "gdbserver",
"type": "shell",
"command": "gdbserver",
"args": [
"--multi",
"--once",
"0.0.0.0:1234",
"${workspaceFolder}/build/test_app"
],
"isBackground": true,
"problemMatcher": {
"fileLocation": "relative",
"pattern": [
{
"regexp": ""
},
{
"regexp": "",
"message": 1
},
{
"regexp": "",
"file": 1,
"line": 2,
"column": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "Listening*"
},
"endsPattern": {
"regexp": "on port 1234*"
}
}
}
}
]
}
project(test)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(test_app
main.cpp)
#include <iostream>
int main(int argc, char** args)
{
std::cout << "Hello World" << std::endl;
std::string input;
while (true)
{
std::getline(std::cin, input);
if (input == "stop")
break;
}
std::cout << "Done" << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment