Skip to content

Commit

Permalink
add documentation on how to enable and use the AddressSanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rauch committed Feb 28, 2022
1 parent 8b0be1c commit e0c92a5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ To install to a different directory than /usr/local:

$ PREFIX=/some/path sudo make install

Debugging
=========

You can enable [AddressSanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) to debug memory issues for Debug builds by setting the `ASAN` option:
```
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DASAN=ON
cmake --build build
```

Mostly you can then run your executables as usual and inspect the sanitiser output. If you get a message like `ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.` you have to preload the corresponding `libasan.so.5` like this:
```
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5 ./build/opencv_demo
```

Flexible Layouts
================
Expand Down

0 comments on commit e0c92a5

Please sign in to comment.