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

Reply via email to