YLiu-5 / program-analysis

playground for static analysis and dynamic analysis: valgrind, sanitizer, profiling.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

program-analysis

playground for static analysis and dynamic analysis: valgrind, sanitizer, profiling.

description

This project explores how to use the dynamic analysis tools.

There are two dynamic analysis tools considered in this project: (Google) Sanitizers and Valgrind.

Sanitizers

Sanitizer is a tool used to perform dynamic analysis of cpp code. It can be used to detect problems including illegal memory read or write, use of uninitialized values, thread race etc. It is designed by google.

There are four types of sanitizers:

  • AddressSanitizer (ASan)
  • MemorySanitizer (MSan)
  • ThreadSanitizer (TSan)
  • UndefinedBehaviorSanitizer (UBSan)

Difference between ASan and MSan: ASan detects memory errors, while MSan detects memory leaks. ASan is not available on MacOS. Run valgrind instead.

Valgrind

Valgrind.

Important:

  • first line name,
  • second line type, memcheck:cond or memcheck:value8,
  • remaining line: fun:mangled names
  • stop when do not match. So, head must be contained. Can use ... to skip lines. Tail can be dropped for wild match.

About

playground for static analysis and dynamic analysis: valgrind, sanitizer, profiling.

License:MIT License


Languages

Language:C++ 91.7%Language:CMake 8.3%