Wrap getenv when linking a coverage-enabled binary
The wrapper to getenv() appends the effective userid (euid) of the
current process to GCOV_PREFIX. This avoids conflicts and permissions
issues when multiple processes try to create/access the same directories
and files under /data/misc/trace.
Bug: 148178774
Test: Verify that coverage files are written to
/data/misc/trace/<euid>/proc/... instead of /data/misc/trace/proc/...
Change-Id: If58081a12b2b9bc40cfcbf64c99beafe198d07af
Merged-In: If58081a12b2b9bc40cfcbf64c99beafe198d07af
(cherry picked from commit 100bbdc8f3
)
This commit is contained in:
parent
2363a2b162
commit
c2cf2c5dbe
|
@ -116,6 +116,8 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
|
|||
|
||||
coverage := ctx.GetDirectDepWithTag(getProfileLibraryName(ctx), coverageDepTag).(*Module)
|
||||
deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
|
||||
|
||||
flags.LdFlags = append(flags.LdFlags, "-Wl,--wrap,getenv")
|
||||
}
|
||||
|
||||
return flags, deps
|
||||
|
|
Loading…
Reference in New Issue