c
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| c [2023/11/06 08:20] – created nine | c [2025/08/04 13:05] (current) – nine | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== C++ development cheat sheet ====== | ||
| + | |||
| + | ===== gdb ===== | ||
| + | |||
| + | |||
| Problem | Problem | ||
| '' | '' | ||
| - | '' | + | |
| + | |||
| + | The solutio is to add a signal handler | ||
| + | handle SIGILL pass nostop noprint | ||
| + | |||
| + | ===== Sanitizer ===== | ||
| + | |||
| + | log to file | ||
| + | ASAN_OPTIONS=" | ||
| + | |||
| + | full docs: https:// | ||
| + | |||
| + | globally for the '' | ||
| + | add_compile_options(-fsanitize=address) | ||
| + | add_link_options(-fsanitize=address) | ||
| + | |||
| + | for a target: | ||
| + | target_compile_options(< | ||
| + | target_link_options(< | ||
| + | |||
| + | ==== tsan ==== | ||
| + | |||
| + | Problem when executing a binary: | ||
| + | FATAL: ThreadSanitizer: | ||
| + | |||
| + | |||
| + | Sulution, disable ASLR for testing: | ||
| + | setarch --addr-no-randomize build/ | ||
| + | |||
| + | or: | ||
| + | sudo sysctl vm.mmap_rnd_bits=30 | ||
| + | |||
| + | ==== alternatives ==== | ||
| - | Solution | + | declare alternatives: |
| + | < | ||
| + | sudo update-alternatives --install / | ||
| + | sudo update-alternatives --install / | ||
| + | sudo update-alternatives --install / | ||
| + | sudo update-alternatives --install / | ||
| + | sudo update-alternatives --install / | ||
| + | sudo update-alternatives --install / | ||
| + | </ | ||
| - | '' | + | select the right alternatives: |
| + | < | ||
| + | sudo update-alternatives --config gcc | ||
| + | sudo update-alternatives --config g++ | ||
| + | sudo update-alternatives --config gcov | ||
| + | </ | ||
c.1699258818.txt.gz · Last modified: 2023/11/06 08:20 by nine