Last active
May 29, 2022 12:00
-
-
Save timll/1c4c542c7c98e3610c14aec19cdf7e91 to your computer and use it in GitHub Desktop.
VSCode GCC Debugging Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your key bindings in this file to override the defaultsauto[] | |
[ | |
{ | |
"key": "tab", | |
"command": "editor.action.insertSnippet", | |
"when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus && (resourceExtname == .cc || resourceExtname == .h || resourceExtname == .c)", | |
"args": { | |
"snippet": " " | |
} | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"configurations": [ | |
{ | |
"preLaunchTask": "Start gdbserver", | |
"postDebugTask": "Exit gdbserver", | |
"name": "Connect to GDB", | |
"type": "cppdbg", | |
"request": "launch", | |
"program": "${workspaceRoot}/host-x86_64-pc-linux-gnu/gcc/xgcc", | |
"miDebuggerServerAddress": "localhost:2345", | |
"miDebuggerArgs": "-x ${workspaceFolder}/.gdbinit", | |
"cwd": "${workspaceRoot}", | |
"externalConsole": true, | |
"linux": { | |
"MIMode": "gdb" | |
}, | |
"postRemoteConnectCommands": [ | |
{ | |
"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 | |
} | |
] | |
} | |
], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Build gcc", | |
"type": "shell", | |
"command": "make", | |
"args": [], | |
"options": { | |
"cwd": "${workspaceFolder}/host-x86_64-pc-linux-gnu/gcc" | |
}, | |
"problemMatcher": [], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
} | |
}, | |
{ | |
"label": "Start gdbserver", | |
"type": "shell", | |
"command": "${workspaceFolder}/host-x86_64-pc-linux-gnu/gcc/xgcc", | |
"args": [ | |
"-B", | |
"/home/tim/Projects/gcc/host-x86_64-pc-linux-gnu/gcc/", | |
"/home/tim/Projects/simple_c/main.c", | |
"-o", | |
"/home/tim/Projects/simple_c/main", | |
"-fanalyzer", | |
"-Wall", | |
"-wrapper", | |
"gdbserver,localhost:2345" | |
], | |
"options": { | |
"cwd": "${workspaceFolder}/host-x86_64-pc-linux-gnu/gcc" | |
}, | |
"isBackground": true, | |
"problemMatcher": { | |
"pattern": { | |
"regexp": "", | |
"file": 1, | |
"location": 2, | |
"severity": 3, | |
"code": 4, | |
"message": 5 | |
}, | |
"background": { | |
"activeOnStart": true, | |
"beginsPattern": { | |
"regexp": "Process", | |
}, | |
"endsPattern": { | |
"regexp": "Listening on port 2345", | |
} | |
} | |
} | |
}, | |
{ | |
"label": "Exit gdbserver", | |
"type": "shell", | |
"command": "pkill", | |
"args": [ | |
"gdbserver" | |
], | |
"options": { | |
"cwd": "${workspaceFolder}/host-x86_64-pc-linux-gnu/gcc" | |
}, | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment