-
Notifications
You must be signed in to change notification settings - Fork 362
sonar.cxx.drmemory.reportPaths
Sensor to read reports from the Dr. Memory tool. Dr. Memory is a memory monitoring tool capable of identifying memory-related programming errors such as accesses of uninitialized memory, accesses to unaddressable memory (including outside of allocated heap units and heap underflow and overflow), accesses to freed memory, double frees, memory leaks, and (on Microsoft Windows) handle leaks, GDI API usage errors, and accesses to un-reserved thread local storage slots.
Note: The cxx plugin itself does not run the tool, you have to do that yourself beforehand. The sensor only reads the report generated by the tool!
- Link to the tool page: http://drmemory.org/
- The sensor supports rules from Dr. Memory with version 1.8.
In order to run Dr. Memory and generate a fitting report, make sure:
- to call it from the projects root directory, so that the paths in the report fit
- that the parameter matches the
sonar.sources
list insonar-project.properties
Sample command lines:
Launch your program with Dr. Memory. The actual call should look something like this:
drmemory.exe -logdir c:/logs -- c:/path/to/my/app
If the tool was executed successfully, a report like the example below should be generated:
Dr. Memory version 1.8.0 build 8 built on Sep 9 2014 16:27:02
Dr. Memory results for pid 3144: "Mask.Acceptance.Tests.exe"
Application cmdline: "Mask.Acceptance.Tests.exe"
Recorded 108 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin\suppress-default.txt
Error #733: LEAK 7300 direct bytes 0x028365b8-0x0283823c + 48336 indirect bytes
# 0 replace_calloc [d:\drmemory_package\common\alloc_replace.c:2413]
# 1 gdCalloc [d:\sample\nonnugetlib\libgd-2.1.1\src\gdhelpers.c:69]
# 2 gdImageCreate [d:\sample\nonnugetlib\libgd-2.1.1\src\gd.c:173]
# 3 WinGraphics::Initialize [d:\sample\sources\maskcpp\core\rendering\graphics\net\netgraphics.cpp:165]
# 4 GraphicsDrawing<>::Initialiser [d:\sample\sources\maskcpp\core\rendering\graphicsdrawing.h:54]
# 5 BitmapGeneratorHelper::Generer [d:\sample\sources\maskcpp\core\bitmapgeneratorhelper.cpp:13]
# 6 BitmapGenerator::Generate [d:\sample\sources\maskcpp\core\bitmapgenerator.cpp:27]
# 7 BitmapGenerationConfiguration::AndGetResultAsBmpContent [d:\sample\sources\maskcpp\factory\maskfactory.h:73]
# 8 MaskAcceptanceTest::LaunchTest [d:\sample\tests\acceptance\acceptancetestexecutor.cpp:78]
# 9 zoom::Zoom_ReportWithWidthSpecified_Test::TestBody [d:\sample\tests\acceptance\zoomtest.cpp:20]
#10 testing::internal::HandleSehExceptionsInMethodIfSupported<> [d:\sample\packages\external.google-test.1.6.2-dev\sources\src\gtest.cc:2075]
#11 testing::internal::HandleExceptionsInMethodIfSupported<> [d:\sample\packages\external.google-test.1.6.2-dev\sources\src\gtest.cc:2126]
- First check if the file extensions read in by the cxx plugin are set (sonar.cxx.file.suffixes).
- The rules for which you want to generate issue must be activated in the Quality Profile of your project. You can find instructions on how to do this under Manage Quality Profiles.
- Set the analysis parameter
sonar.cxx.drmemory.reportPaths
in the configuration filesonar-project.properties
of your project. The Report Paths link describes the configuration options. - Normally the File Encoding is UTF-8. Use the parameter sonar.cxx.drmemory.encoding to use another one.
- Execute the SonarScanner to transfer the project with the report to the SonarQube Server.
- With CXX Custom Template Rules it's possible to extend the rule repository.
- It is also possible to display unknown rules on the SonarQube Server.
Sample for sonar-project.properties:
sonar.cxx.drmemory.encoding=UTF-8
sonar.cxx.drmemory.reportPaths=c:/logs/**/results.txt
- If no results are displayed after a successful scan, check Manage Quality Profiles first.
- If you cannot find an issue under 'New code', also look under 'Overall code' to see if it is listed there.
- If scanning is failing, check items listed under Troubleshooting Configuration.
- If no issues are displayed for your source code in SonarQube, check the items listed under Troubleshooting Reports.
- In the case of incomplete scans, Detect and fix parsing errors gives advice on how to fix this.