User Tools

Site Tools


c

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
c [2023/11/06 08:20] – created ninec [2025/02/20 12:47] (current) – [tsan] nine
Line 1: Line 1:
 +====== C++ development cheat sheet ======
 +
 +===== gdb =====
 +
 +
 Problem Problem
  
 ''gdb'' warns about unhandled signal: ''gdb'' warns about unhandled signal:
  
-''Program received signal SIGILL, illegal instruction.''+  Program received signal SIGILL, illegal instruction. 
 + 
 +The solutio is to add a signal handler 
 +  handle SIGILL pass nostop noprint 
 +   
 +===== Sanitizer ===== 
 + 
 +log to file 
 +  ASAN_OPTIONS="log_path=asan.log" ./a.out 
 +   
 +full docs: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags 
 + 
 +globally for the ''CMakeLists.txt'' project: 
 +  add_compile_options(-fsanitize=address) 
 +  add_link_options(-fsanitize=address) 
 + 
 +for a target: 
 +  target_compile_options(<build-target> PRIVATE -fsanitize=address) 
 +  target_link_options(<build-target> PRIVATE -fsanitize=address) 
 + 
 +==== tsan ==== 
 + 
 +Problem when executing a binary: 
 +  FATAL: ThreadSanitizer: unexpected memory mapping 0x5a36aaebd000-0x5a36aafd2000 
  
-Solution+Sulution, disable ASLR for testing: 
 +  setarch --addr-no-randomize build/path/to/binary
  
-''handle SIGILL pass nostop noprint''+or: 
 +  sudo sysctl vm.mmap_rnd_bits=30   # 30: partly, 28 totally
c.1699258818.txt.gz · Last modified: 2023/11/06 08:20 by nine