-
-
Notifications
You must be signed in to change notification settings - Fork 210
Debug symbols in various languages and build systems
matu3ba edited this page Jul 25, 2021
·
1 revision
For debugging advanced language features like macros, check the build system/compiler documentation.
clang/gcc/tcc.. -g # simpler C compilers like tcc dont have optimisation levels
clang/gcc -O0/O1/-O2/-O3 # prefer -O0 for getting more debugging symbols
clang/gcc -g
clang/gcc -O0/O1/-O2/-O3 # prefer -O0 for getting more debugging symbols
RUSTFLAGS=-g cargo build # better use profiles in `Cargo.toml`
RUSTFLAGS='-g --opt-level=1' cargo build # Both are slow to write and force debugging info for all projects.
zig build-exe -O Debug
# `CMakeLists.txt` can require hard to understand stuff like `set(CMAKE_BUILD_TYPE "Release" CACHE STRING FORCE)` for debugging.
cmake -DCMAKE_BUILD_TYPE="Debug" # keep it simple. `RelWithDebInfo` also an option
meson setup buildfolder ----buildtype debug # default is `debug`
meson configure ----buildtype `debug|debugoptimized` # default is debug