vscode debug

This commit is contained in:
Timerix22 2023-11-19 22:35:22 +06:00
parent 16f86ce592
commit 1b5efdb146
4 changed files with 69 additions and 3 deletions

34
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,34 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Debug",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}/bin",
"windows": {
"program": "${workspaceFolder}\\bin\\cbuild.exe",
},
"linux": {
"program": "${workspaceFolder}/bin/cbuild",
},
"preLaunchTask": "build",
"stopAtEntry": false,
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "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
}
]
}
]
}

24
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "build",
"command": "bash",
"args": [
"${workspaceRoot}/build.sh",
"debug"
],
"options": {
"cwd": "${workspaceRoot}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@ -4,7 +4,15 @@ set -eo pipefail
CONFIG_DIR="/etc/cbuild" CONFIG_DIR="/etc/cbuild"
CMP="gcc" CMP="gcc"
WARN="-Wall -Wextra -Wno-discarded-qualifiers -Wno-unused-parameter" WARN="-Wall -Wextra -Wno-discarded-qualifiers -Wno-unused-parameter"
ARGS="-O2 -flto -fdata-sections -ffunction-sections -Wl,--gc-sections"
ARGS_DEBUG="-O0 -g"
ARGS_RELEASE="-O2 -flto=auto -fdata-sections -ffunction-sections -Wl,--gc-sections"
if [ "$1" -eq "debug" ]; then
ARGS=$ARGS_DEBUG
else
ARGS=$ARGS_RELEASE
fi
SRC="$(find src -name '*.c')" SRC="$(find src -name '*.c')"
OS="$(./detect_os.sh)" OS="$(./detect_os.sh)"
@ -32,7 +40,7 @@ if [ ! -f "kerep/bin/libkerep-$OS-$ARCH.a" ]; then
fi fi
rm -rf bin rm -rf bin
mkdir bin mkdir -p bin
echo "----------------[cbuild]----------------" echo "----------------[cbuild]----------------"
echo "$command" echo "$command"

View File

@ -3,7 +3,7 @@ set -eo pipefail
CMP="gcc" CMP="gcc"
WARN="-std=c11 -Wall -Wno-discarded-qualifiers -Wno-unused-parameter" WARN="-std=c11 -Wall -Wno-discarded-qualifiers -Wno-unused-parameter"
ARGS="-O2 -flto -fpic -fdata-sections -ffunction-sections" ARGS="-O2 -flto=auto -fpic -fdata-sections -ffunction-sections"
SRC="$(find src -name '*.c')" SRC="$(find src -name '*.c')"
OS=$(../detect_os.sh) OS=$(../detect_os.sh)