Closed Bug 1406081 Opened 7 years ago Closed 7 years ago

JS engine needs signal handlers for GCOV

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
blocker

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: decoder, Assigned: decoder)

References

(Blocks 1 open bug)

Details

(Keywords: sec-want, Whiteboard: [adv-main58-])

Attachments

(2 files)

Apparently the JS shell builds we produce lack the signal handlers we implemented in bug 1363469. We need move the code for these signal handlers such that it is available in the shell and also expose --enable-coverage (currently defined in toolkit) for these builds. This blocks coverage reports for the JS shell fuzzing.
I looked at sharing the existing code in tools/code-coverage/ with the JS shell but decided that sharing this code probably adds more code in total than just duplicating the relevant parts adds. The shell doesn't need any kind of inter-process locks nor does it need shutdown hooks. Separating out the signal handler installs to mozglue also comes with a fair amount of additional code because the callbacks would be different (browser callbacks needs methods with mutexes). So I decided to just share the --enable-coverage flag and copy relevant signal handler code with minor adjustments to js/src/shell/js.cpp which should only be built with the standalone shell as far as I know.
Comment on attachment 8915644 [details] Bug 1406081 - Make --enable-coverage flag available in JS shell. https://reviewboard.mozilla.org/r/186832/#review191924 ::: build/moz.configure/toolchain.configure:1322 (Diff revision 1) > +option('--enable-coverage', env='MOZ_CODE_COVERAGE', > + help='Enable code coverage') This needs to be `js_option` to wind up being exposed to the JS shell in browser builds. Otherwise, I'm 90% sure that you wind up in the confusing situation that `--enable-coverage` works for the shell in shell-only builds, but not in browser builds.
Attachment #8915644 - Flags: review?(nfroyd) → review+
Comment on attachment 8915645 [details] Bug 1406081 - Add GCOV signal handlers to JS shell. https://reviewboard.mozilla.org/r/186834/#review192222 Makes sense. ::: js/src/shell/js.cpp:163 (Diff revision 1) > +#if defined(__GNUC__) && !defined(__clang__) > +extern "C" void __gcov_dump(); > +extern "C" void __gcov_reset(); > + > +void counters_dump(int) { > + __gcov_dump(); Nit: 4 space indent instead of 2 here and in the rest of the patch. ::: js/src/shell/js.cpp:171 (Diff revision 1) > +void counters_reset(int) { > + __gcov_reset(); > +} > +#else > +void counters_dump(int) { > + /* Do nothing */ Do we want to support this configuration? Should we MOZ_CRASH or (at compile time) #error? ::: js/src/shell/js.cpp:179 (Diff revision 1) > +void counters_reset(int) { > + /* Do nothing */ > +} > +#endif > + > +static void InstallCoverageSignalHandlers() Nit: \n after |static void|
Attachment #8915645 - Flags: review?(jdemooij) → review+
Pushed by choller@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5ef339233c71 Make --enable-coverage flag available in JS shell. r=froydnj https://hg.mozilla.org/integration/autoland/rev/8b711541ec46 Add GCOV signal handlers to JS shell. r=jandem
Whiteboard: [adv-main58-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: