From 546d79ae6d2b051dd6ed6af1650020712d1f6e18 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Sat, 21 Mar 2020 16:31:20 +0100 Subject: [PATCH] Adds cpp demo. --- demos/cpp/.gitignore | 1 + demos/cpp/.vscode/launch.json | 29 +++++++++++++++++++++++++++++ demos/cpp/.vscode/tasks.json | 25 +++++++++++++++++++++++++ demos/cpp/main.cpp | 14 ++++++++++++++ extension/README.md | 1 + 5 files changed, 70 insertions(+) create mode 100644 demos/cpp/.gitignore create mode 100644 demos/cpp/.vscode/launch.json create mode 100644 demos/cpp/.vscode/tasks.json create mode 100644 demos/cpp/main.cpp diff --git a/demos/cpp/.gitignore b/demos/cpp/.gitignore new file mode 100644 index 0000000..88d050b --- /dev/null +++ b/demos/cpp/.gitignore @@ -0,0 +1 @@ +main \ No newline at end of file diff --git a/demos/cpp/.vscode/launch.json b/demos/cpp/.vscode/launch.json new file mode 100644 index 0000000..1c812cf --- /dev/null +++ b/demos/cpp/.vscode/launch.json @@ -0,0 +1,29 @@ +{ + // 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": "g++ build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${fileDirname}/${fileBasenameNoExtension}", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "g++ build active file", + "miDebuggerPath": "/usr/bin/gdb" + } + ] +} \ No newline at end of file diff --git a/demos/cpp/.vscode/tasks.json b/demos/cpp/.vscode/tasks.json new file mode 100644 index 0000000..366a347 --- /dev/null +++ b/demos/cpp/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "label": "g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "/usr/bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": "build" + } + ] +} \ No newline at end of file diff --git a/demos/cpp/main.cpp b/demos/cpp/main.cpp new file mode 100644 index 0000000..a2f6576 --- /dev/null +++ b/demos/cpp/main.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +using namespace std; + +int main() +{ + // visualize `myGraphJson`! + string myGraphJson = "{\"kind\":{\"graph\":true}," + "\"nodes\":[{\"id\":\"1\"},{\"id\":\"2\"}]," + "\"edges\":[{\"from\":\"1\",\"to\":\"2\"}]}"; + cout << myGraphJson; +} \ No newline at end of file diff --git a/extension/README.md b/extension/README.md index b3063e7..783b2da 100644 --- a/extension/README.md +++ b/extension/README.md @@ -16,6 +16,7 @@ See [demos](./demos/) for demos. These languages and debuggers are verified to w - C# using `coreclr` debug adapter: ✅ Rudimentary Support - PHP using `php` debug adapter: ✅ Rudimentary Support - Java using `java` debug adapter: ✅ Rudimentary Support +- C++ using `cppdbg` debug adapter: ✅ Rudimentary Support All other languages and debuggers might work too.