# CSCE12x VSCode Debugger Configuration Make sure your `tasks.json` looks liks this: ```json { "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++ build active file", "command": "/usr/bin/g++", "args": [ "-g", "-std=c++17", "-Wall", "-Wextra", "-pedantic-errors", "-Weffc++", "-Wno-unused-parameter", "-fsanitize=undefined,address", "${relativeFileDirname}/*.cpp", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: /usr/bin/g++" }, { "label": "Run", "type": "shell", "dependsOn": "Build", "command": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "presentation": { "reveal": "always", "focus": true }, "problemMatcher": [], "group": { "kind": "build", "isDefault": true } } ] } ``` Add this to your `launch.json`: ```json { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}", "args": ["-I${workspaceFolder}"], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "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": "C/C++: g++ build active file", } ] } ``` To make this permanent, press `Ctrl-Shift-P` and open "User Settings (JSON)". `settings.json` file should now open. Add this to your config: ```json , "launch": { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/${fileBasenameNoExtension}", "args": [ "-I${workspaceFolder}" ], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": false, "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": "C/C++: g++ build active file", } ] }, ```