- Install CodeLLDB in VSCode
- Create
launch.json
with code below - Adapt
makefile
to include the debug symbols
ref. CodeLLDB doco https://github.com/vadimcn/codelldb/blob/master/MANUAL.md
launch.json
with code belowmakefile
to include the debug symbolsref. CodeLLDB doco https://github.com/vadimcn/codelldb/blob/master/MANUAL.md
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "CodeLLDB", | |
"type": "lldb", | |
"request": "launch", | |
"program": "${workspaceFolder}/<binary>", | |
"args": [ | |
], | |
} | |
] | |
} |
COMPILER = clang | |
SOURCE_LIBS = -Ilib/ -Llib/ | |
INCLUDES = -include **.h # NOTE not used below as it compiles the *.h files as well and generates multiple outputs | |
# OSX_OPT = -framework CoreVideo -framework IOKit -framework Cocoa -framework OpenGL | |
WARNINGS = -Wall | |
DEBUG_BUILD = -g -v -o "binary" -std=c99 | |
LEAKS_BUILD = -v -o "binary" -std=c99 -fsanitize=address | |
RELEASE_BUILD = -o "binary-release" -std=c99 # -O1 O2 remove the hex map? | |
CFILES = **.c | |
# for debug -fsanitize=address | |
export ASAN_OPTIONS := allocator_may_return_null=1 | |
build_osx: | |
$(COMPILER) $(CFILES) $(SOURCE_LIBS) $(WARNINGS) $(DEBUG_BUILD) | |
./binary | |
leaks: | |
$(COMPILER) $(CFILES) $(SOURCE_LIBS) $(WARNINGS) $(LEAKS_BUILD) | |
./binary | |
clean: | |
rm -rf binary.* | |
rm binary-* | |
release: | |
$(COMPILER) $(CFILES) $(SOURCE_LIBS) $(WARNINGS) $(RELEASE_BUILD) |