casaroli commented on code in PR #3886:
URL: https://github.com/apache/nuttx-apps/pull/3886#discussion_r4319224552
##########
Application.mk:
##########
@@ -27,15 +27,15 @@
ifneq ($(MAINSRC),)
ifeq ($(DYNLIB),y)
BUILD_MODULE = y
- MODAELFFLAGS = $(CMODULELFFLAGS)
- MODCFLAGS = $(CMODULEFLAGS)
- MODCXXFLAGS = $(CXXMODULEFLAGS)
+ MODAELFFLAGS = $(filter-out $(NOCOVERAGE),$(CMODULELFFLAGS))
Review Comment:
Exporting the gcov functions alone is not enough: `__gcov_init()` adds the
gcov_info of a module to the list of the runtime, and it stays there after the
module is unloaded, so the next dump reads freed memory.
With `CONFIG_COVERAGE_MINI` (libs/libbuiltin gcov.c) I will export the
functions to modules and add a hook that removes (and first dumps) the
gcov_info of a module when the loader unloads it. Then modules keep their
coverage options.
With `CONFIG_COVERAGE_TOOLCHAIN` (sim:nsh in CI) the runtime is libgcov:
there is no call to remove one gcov_info, and the `__gcov_exit()` of a module
dumps the data of the whole image, marks it dumped and unlinks it. A correct
fix gives each module its own libgcov, as a shared library has on Linux. Which
behaviour do you need there: keep building modules without coverage with
libgcov, export the functions anyway (a module that is unloaded before the dump
breaks the later dumps), or is your setup one where modules are never unloaded
before the dump?
--
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]