Address Sanitizer[]
- Memory error detector that can be used in clang and gcc.
- In Xcode clang it's disabled so you need to use MacPorts clang or other non-Apple clang to enable it.
- Algorithm
- basically overwrites memory access operation generated by compiler
- though the important part is how to speed up the overwrited operation
- debugger setting
- to stop before report set breakpoint to __asan_report_error which will be called by __asan_report_{load,store}{1,2,4,8,16}
- to stop after report set env "ASAN_OPTIONS=abort_on_error=1" or set a breakpoint to AsanDie
Instruments[]
- Profiling tool installed with Xcode
gdb[]
- GNU DeBuger
- repository
- Well used command
command | short | |
---|---|---|
backtrace | bt | print backtrace in current state |
run | r | restart executable |
break | b | set break point |
addr2line[]
- reference
- command to get line number from executable address.
- winaddr2line
- binutils code
Demangle[]
- c++filt
- command to decode C++ function symbol.
- binutils code
- C way
Backtrace[]
- mingw-w64 backtrace
- mingw backtrace
- backtrace from C++ exceptions
- Boost.Backtrace
- Linux backtrace
- backtrace technique
- using addr2line to get source code line.
- clean C++ symbol by demangling.
- glibc backtrace
- win32 backtrace
- Linux article journal
- mingw-w64 implementation
- execinfo.h
- example using libbfd
tracef[]
- example
- command to trace all function calls.