diff --git a/slides/pages/clang-5.md b/slides/pages/clang-5.md new file mode 100644 index 0000000000000000000000000000000000000000..2abfaddfbee1acd2eb40936d98b590e21b6a6648 --- /dev/null +++ b/slides/pages/clang-5.md @@ -0,0 +1,23 @@ +--- +title: Dynamic Analysis +--- + +# Dynamic Analysis + +There are tools that help you automatically detect memory management and threading bugs. + +- [Valgrind](https://valgrind.org/) (not available on lower version of OS X and Windows) +- [Sanitizer](https://github.com/google/sanitizers) (integrated into `gcc` and `clang`) + +## Basic Usage + +```bash +# Using AddressSanitizer - dectect memory errors, memory leaks etc. +clang -fsanitize=address -g -O2 -fno-omit-frame-pointer <your c source file> + +# Using MemorySanitizer - detect uninitialized memory read +clang -fsanitize=memory -fPIE -pie -fno-omit-frame-pointer -g -O2 <your c source file> + +# Using Valgrind, you need to first compile your program +valgrind --leak-check=full --show-leak-kinds=all <program> <arg1> <arg2> ... +``` diff --git a/slides/slides.md b/slides/slides.md index f29ad940db476410f8674cba666d835c7b0e7870..c3bc38ba94ebedd68683e5322cb205ee7d2af751 100644 --- a/slides/slides.md +++ b/slides/slides.md @@ -68,3 +68,9 @@ src: ./pages/clang-3.md transition: slide-left src: ./pages/clang-4.md --- + +--- +transition: slide-left +src: ./pages/clang-5.md +--- +