For an academic research project, we use Chrome Devtools Protocol to set breakpoints at function returns, and collect function call metadata (stack frames, arguments, timestamps) using a condition script(*).
Although the condition script always returns `false` to avoid pausing the debugger, we still observe a significant overhead per "hit" breakpoint.
To identify the root cause, we set up tracing and found that V8.ParseProgram is called for each "hit" breakpoint. We then logged function events using "--js-flags=--log-function-events", which showed that all functions in the debugged script is fully parsed (i.e., `function,full-parse,...` event) for each "hit" breakpoint.
For example, assume the debugged script contains 10K function
definitions, of which only a 100 is called. We observe ~10K*100=~1M
function (full-)parse events in the logs, which slows down the process and makes it unfeasible on heavy websites.
1) Is it possible to
prevent repeated parsing of the debugged script for each evaluated breakpoint?
2) Could there be an easier and faster way of logging all function calls with the associated stack frames and arguments? Pointers to the relevant code locations would be much appreciated if modifying Chrome/V8 source code is the only way to do that.
The trace and test files can be found in this Gist.Thanks so much and stay safe,
Gunes
PS: None of our breakpoints were actually hit, since the condition script always returns false. Also, the debugged scripts were not modified during the execution through `Debugger.setScriptSource` or by any other means
*: Idea from the DuckDuckGo’s Tracker Radar Collector
--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/f3242ed8-a082-4b68-868b-1a18f9d98323n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CAGRskv8nby_co6K6%2Bxcyq-WKVvq4_SodGCczQAH_Wg_oTJ%2BBEg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CALH_77sN_wbzqsJeDq82eyactH%3D0Xq%3DYdbfHD4T-Fr0YD%2Byiew%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/MN2PR00MB0735AC85AB14CB4618055B9B8B0D1%40MN2PR00MB0735.namprd00.prod.outlook.com.