Skip to content

Commit

Permalink
[docs] Explain how to use Leak Sanitizer and it's converter on a file
Browse files Browse the repository at this point in the history
- Leak Sanitizer documentation in report converter explains the usage
  of lsan tool on any c file
- Enabled leak sanitizer in supported code analyzers
  • Loading branch information
jay24rajput committed Jul 6, 2021
1 parent 1311357 commit a4f3b28
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/supported_code_analyzers.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CodeChecker result directory which can be stored to a CodeChecker server.
| [MemorySanitizer](https://clang.llvm.org/docs/MemorySanitizer.html) ||
| [UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) ||
| [DataFlowSanitizer](https://clang.llvm.org/docs/DataFlowSanitizer.html) ||
| [LeakSanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) | |
| [LeakSanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) | |

We support to convert multiple sanitizer output to a CodeChecker report
directory which can be stored to a CodeChecker server by using our
Expand Down
21 changes: 18 additions & 3 deletions docs/tools/report-converter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ a CodeChecker server.
* [Address Sanitizer](#address-sanitizer)
* [Memory Sanitizer](#memory-sanitizer)
* [Thread Sanitizer](#thread-sanitizer)
* [Leak Sanitizer](#leak-sanitizer)
* [Cppcheck](#cppcheck)
* [Spotbugs](#spotbugs)
* [Facebook Infer](#facebook-infer)
Expand Down Expand Up @@ -62,9 +63,9 @@ optional arguments:
-t TYPE, --type TYPE Specify the format of the code analyzer output.
Currently supported output types are: asan, clang-
tidy, coccinelle, cppcheck, cpplint, eslint,
fbinfer, golint, kernel-doc, mdl, msan, pyflakes,
pylint, smatch, sparse, sphinx, spotbugs, tsan,
tslint, ubsan.
fbinfer, golint, kernel-doc, lsan, mdl, msan,
pyflakes, pylint, smatch, sparse, sphinx, spotbugs,
tsan, tslint, ubsan.
--meta [META [META ...]]
Metadata information which will be stored alongside
the run when the created report directory will be
Expand Down Expand Up @@ -97,6 +98,7 @@ Supported analyzers:
fbinfer - Facebook Infer, https://fbinfer.com
golint - Golint, https://github.com/golang/lint
kernel-doc - Kernel-Doc, https://github.com/torvalds/linux/blob/master/scripts/kernel-doc
lsan - LeakSanitizer, https://clang.llvm.org/docs/LeakSanitizer.html
mdl - Markdownlint, https://github.com/markdownlint/markdownlint
msan - MemorySanitizer, https://clang.llvm.org/docs/MemorySanitizer.html
pyflakes - Pyflakes, https://github.com/PyCQA/pyflakes
Expand Down Expand Up @@ -186,6 +188,19 @@ clang++ -fsanitize=thread -g tsan.cpp
report-converter -t tsan -o ./tsan_results tsan.output
```

### [Leak Sanitizer](https://clang.llvm.org/docs/LeakSanitizer.html)
- Compile with `-g` and `-fsanitize=address` to get proper debug information in your binary.
```sh
# Compile your program.
clang -fsanitize=address -g lsan.c

# Run your program and redirect the output to a file.
ASAN_OPTIONS=detect_leaks=1 ./a.out > lsan.output 2>&1

# Generate plist files from the output.
report-converter -t lsan ./lsan_results lsan.output
```

## [Cppcheck](http://cppcheck.sourceforge.net/)
[Cppcheck](http://cppcheck.sourceforge.net/) is a static analysis tool for
`C/C++` code.
Expand Down

0 comments on commit a4f3b28

Please sign in to comment.