W-M-R opened a new pull request, #21350:
URL: https://github.com/apache/nuttx/pull/21350
## Summary
The kernel-side gcov runtime lags behind the implementation used downstream.
This series updates it, one patch per functional change:
- add the gcov framework and the missing `__gcov_*` instrumentation entry
points;
- dump coverage data on reboot through the reboot notifier;
- fix the gcov fork path, the pile-insertion recursion and stack checking;
- use `lib_get_tempbuffer()` instead of the stack for the dump buffer;
- refactor the dump framework and move the output-mode decision into the
kernel;
- split `gcov.c` into `gcov.c`, `gcov_write.c` and `gcov_internal.h`
(gcov 12+ gcno/gcda format, TOP-N counters);
- add the `gcov()` syscall so applications can reset/dump kernel coverage;
- add the binary dump mode, bound path concatenation with `strlcat()`, skip
the
dump in the panic/IRQ reboot path, and buffer the one-file dump to avoid
the
9pfs busyloop;
- document the flow and the coverage options.
PGO (`CONFIG_COVERAGE_PGO`) and the matching toolchain flags are a separate
follow-up and are not part of this series.
## Impact
- Only affects `CONFIG_COVERAGE_MINI` / `CONFIG_COVERAGE_ALL` builds; the
default
configuration is unchanged.
- New Kconfig option `GCOV_COUNTER_POOL_SIZE`.
- New syscall `gcov()` in `syscall/syscall.csv`, built only when
`CONFIG_COVERAGE_ALL` is enabled.
- No effect on hardware, security or documentation outside gcov.
## Testing
Host: Ubuntu 22.04 x86_64, `arm-none-eabi-gcc` 13.
1. The public header is self-contained and compiles:
$ printf '#include <gcov.h>\n' > /tmp/t.c
$ arm-none-eabi-gcc -fsyntax-only -I include -I arch/arm/include /tmp/t.c
2. Syntax check of the runtime sources against the generated `config.h`:
$ arm-none-eabi-gcc -fsyntax-only -I include -I arch/arm/include \
libs/libbuiltin/libgcc/gcov.c
$ arm-none-eabi-gcc -fsyntax-only -I include -I arch/arm/include \
libs/libbuiltin/libgcc/gcov_write.c
3. Kconfig parses on `mps3-an547:gcov`.
Full image build is not included here — the board defconfig selects the clang
toolchain, which is not available in this environment. Please attach the
`mps3-an547:gcov` build log and a `gcov dump -d` run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]