Your ESP-IDF project should be configured to generate gcda/gcno coverage files using gcov. Please take a look at the ESP-IDF gcov example to see how to set up your project.
This extension also requires gcovr
to generate JSON and HTML reports from generated files. This is installed as part of this extension ESP-IDF Debug Adapter Python requirements when following the ESP-IDF: Configure ESP-IDF extension command.
Please take a look at ONBOARDING for more information.
Make sure you had properly configure xtensa toolchain in idf.customExtraPaths
or in your environment variable PATH since the gcov executable used is xtensa-esp32-elf-gcov
and gcovr
exists in the same directory as your ${idf.pythonBinPath}
path.
For the text editor highlighting, we use execute a child process with gcovr -r . --gcov-executable xtensa-eslp-elf-gcov --json
. This assumes you had configure your extension with Xtensa toolchain in idf.customExtraPaths
and installed the gcovr
from Debug adapter's python requirements.
For the text editor, we use the json object generated by the previous command to highlight each line if it is covered or if it is not. We don't highlight noncode lines.
You can customize highlight color using the extension settings. Visual Studio code support "red"
, rgb(255,0,120)
or rgba(120,0,0,0.1)
.
- Covered lines use
idf.coveredLightTheme
for light themes andidf.coveredDarkTheme
for dark themes. - Partially covered lines use
idf.partialLightTheme
for light themes andidf.partialDarkTheme
for dark themes. - Non-covered lines use
idf.uncoveredLightTheme
for light themes andidf.uncoveredDarkTheme
for dark themes.
We execute a child process with command gcovr -r . --gcov-executable xtensa-eslp-elf-gcov --html
for the HTML report. This assumes you had configure your extension with Xtensa toolchain in idf.customExtraPaths
and installed the gcovr
from Debug adapter's python requirements.
With the generated HTML, we generate a Webview Panel with report from gcovr
.