I thought someone did experiments with the Debugger API and concluded that
using it to capture code coverage was too slow to be practical: we need
something built into the engine that is fast.

Also, part of the Engineering Operations Strategic Plan is to provide
better data and metrics (including code coverage). Speaking as a member of
that organization, I'd love to deliver JavaScript code coverage. I'm pretty
sure we need the SpiderMonkey Team to step up and implement something.

On Tue, Jan 20, 2015 at 1:30 PM, Nick Fitzgerald <nfitzger...@mozilla.com>
wrote:

> I recommend reading
> https://developer.mozilla.org/en-US/docs/Tools/Debugger-API or
> js/src/doc/Debugger/ for more information.
>
> On Tue, Jan 20, 2015 at 1:29 PM, Nick Fitzgerald <nfitzger...@mozilla.com>
> wrote:
>
> > ​On Mon, Jan 19, 2015 at 12:36 PM, Joshua Cranmer [image: 🐧] <
> > pidgeo...@gmail.com> wrote:
> >
> >> Getting good code coverage (line and branch coverage) ultimately
> requires
> >> fine-grained instrumentation (ideally bytecode-level) not presented by
> the
> >> current Debugger.
> >>
> >
> >
> > ​I think you can get fine-grained enough data with the existing Debugger
> > API by doing the following:
> >
> > * Adding all existing globals as debuggees: `Debugger.prototype.
> > addAllGlobalsAsDebuggees`
> >
> > * Adding new globals as debuggees: have your Debugger's onNewGlobal hook
> > to always add the new global as a debuggee.
> >
> > * For each `Debugger.Script` (on initialization via
> > `Debugger.prototype.findScripts` and on new scripts in the future via the
> > `onNewScript` hook):
> >
> > *** Use `Debugger.Script.prototype.getAllOffsets`​ to get all byte code
> > offsets which are entry points to each line in the script
> >
> > *** Set a breakpoint on each of those offsets which, when hit, records
> > that the offset's line was executed
> >
> >
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to