coverage: C++ fix loop in gcov_coverage_dump #31029
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During coverage reports generation in C++ code gcov_coverage_dump()
function would get stuck in endless loop. Fix by checking list head
pointer with current list pointer.
Signed-off-by: Marko Poljanic [email protected]
Environment:
Host: macOS 11.1
Cross toolchain: gcc-arm-none-eabi-9-2020-q2-update
Steps to test the fix:
Test will run in qemu and dump gcov data to log.log file after that it is possible to generate .html coverage report.
cd $ZEPHYR_BASE/tests/application_development/gen_inc_file
west build -b mps2_an385 -- -DCONFIG_COVERAGE=y -DCONFIG_COVERAGE_GCOV=y -DCONFIG_COVERAGE_DUMP=y
ninja -Cbuild run | tee log.log
python3 $ZEPHYR_BASE/scripts/gen_gcov_files.py -i log.log
cp src/main.cpp build/CMakeFiles/app.dir/src
cd build/CMakeFiles/app.dir
gcovr -r . --html -o coverage.html --html-details --gcov-executable <gcov_path_in_SDK>
Related to:
#20729