Thanks Jakob: I'll explore one of these options. On Thursday, October 6, 2022 at 2:27:06 AM UTC-4 [email protected] wrote:
> You're right, we currently only output --trace-block-coverage through > stdout. If redirecting stdout is not possible in your use case (and stdout > is not visible/accessible), I'd say the easiest fix is to patch V8 s.t. > --trace-block-coverage prints to a file, and rebuild. See all > v8_flags.trace_block_coverage > occurrences > <https://source.chromium.org/search?q=v8_flags.trace_block_coverage&ss=chromium%2Fchromium%2Fsrc>. > > You'd also have to disable the chrome sandbox with --no-sandbox to have > access to the file system. > > Or alternatively, patch whatever runner you use to redirect stdout when > spawning chrome. > > On Wed, Oct 5, 2022 at 5:41 PM 'Cecil King' via v8-dev < > [email protected]> wrote: > >> Hello Jakob: >> Can you provide some additional advice on collecting the >> '--trace-block-coverage' output? >> >> If I run chrome directly from the command-line and then enable coverage, >> then I can see the trace output in the terminal. (I'm on Linux.) >> >> However, when chrome is launched via wdio (webdriver.io), then the trace >> output is not accessible. >> >> I tried adding `--log-file` to the options for launching chrome from wdio >> (something equivalent to the following: `chromium >> --js-flags="--trace-block-coverage" --enable-logging >> --log-file="./v8-coverage.log"`) but the `--log-file` option doesn't >> capture the trace output. >> >> I inquired over on the webdriver.io forum ... but there were no >> immediate solutions. They suggested that perhaps I can implement this >> feature (https://github.com/giggio/node-chromedriver/issues/313) to have >> chromedriver capture chrome's output. However our project doesn't use >> chromedriver (as far as I can tell ... chromedriver is not in the install >> packages and it's not installed globally). >> >> Upon looking through closed chromium bugs to see if there was an existing >> solution, I saw mention of the `chrome://tracing` feature, and I can see >> that `v8` is listed in the `Record Categories`. However on first pass, it >> doesn't seem this interface is capturing the `trace-block-coverage`. >> >> Any tips on dumping the trace data to a file, so I can include it with a >> bug report? >> >> Thanks. >> On Wednesday, September 21, 2022 at 11:28:12 AM UTC-4 Cecil King wrote: >> >>> Thanks Jakob: >>> I'll give this a try and add any additional information I find to the >>> bug report. >>> >>> On Wednesday, September 21, 2022 at 2:27:24 AM UTC-4 [email protected] >>> wrote: >>> >>>> Hi Cecil, >>>> >>>> it's hard to say much without a repro. I'd start by trying the V8 flag >>>> --trace-block-coverage ( >>>> https://source.chromium.org/chromium/chromium/src/+/main:v8/src/debug/debug-coverage.cc;l=481;drc=5f2ed43ac6add2683505e130be73826cbb3dddfd). >>>> >>>> If that doesn't help, the next step would be to debug more around >>>> Coverage::Collect. >>>> >>>> Also, I'd suggest to file a report at crbug.com/v8/new to continue the >>>> conversation since bug reports are easier to track than mails :) >>>> >>>> On Tue, Sep 20, 2022 at 9:39 PM 'Cecil King' via v8-dev < >>>> [email protected]> wrote: >>>> >>>>> Hello. >>>>> >>>>> My first post here. I'm looking for advice on debugging an issue with >>>>> the v8 code coverage. >>>>> >>>>> I'm using startPreciseCoverage / takePreciseCoverage to extract code >>>>> coverage data from Chrome (i.e. v8). >>>>> >>>>> My issue: data from uncovered functions are missing from the dumped >>>>> data. >>>>> For example, assume the handleSubmit function in authors.js is not >>>>> called. I expect to see this: >>>>> { >>>>> "scriptId": "16", >>>>> "url": >>>>> "file:///home/<user>/v8-chrome-coverage-wdio-sync/public/js/authors.js", >>>>> "functions": [ >>>>> { >>>>> "functionName": "", >>>>> "ranges": [{ "startOffset": 0, "endOffset": 828, "count": >>>>> 1 }], >>>>> "isBlockCoverage": true }, >>>>> { >>>>> "functionName": "showContent", >>>>> "ranges": [{ "startOffset": 71, "endOffset": 448, "count": >>>>> 1 }], >>>>> "isBlockCoverage": true >>>>> }, >>>>> { >>>>> "functionName": "", >>>>> "ranges": [{ "startOffset": 274, "endOffset": 444, >>>>> "count": 3 }], >>>>> "isBlockCoverage": true >>>>> }, >>>>> { >>>>> "functionName": "handleSubmit", >>>>> "ranges": [{ "startOffset": 450, "endOffset": 703, >>>>> "count": 0 }], >>>>> "isBlockCoverage": false >>>>> } >>>>> ] >>>>> }, >>>>> >>>>> but instead I get this: >>>>> { >>>>> "scriptId": "16", >>>>> "url": >>>>> "file:///home/<user>/v8-chrome-coverage-wdio-sync/public/js/authors.js", >>>>> "functions": [ >>>>> { >>>>> "functionName": "", >>>>> "ranges": [{ "startOffset": 0, "endOffset": 828, "count": >>>>> 1 }], >>>>> "isBlockCoverage": true }, >>>>> { >>>>> "functionName": "showContent", >>>>> "ranges": [{ "startOffset": 71, "endOffset": 448, "count": >>>>> 1 }], >>>>> "isBlockCoverage": true >>>>> }, >>>>> { >>>>> "functionName": "", >>>>> "ranges": [{ "startOffset": 274, "endOffset": 444, >>>>> "count": 3 }], >>>>> "isBlockCoverage": true >>>>> } >>>>> ] >>>>> }, >>>>> >>>>> i.e. there is no data at all on the uncovered function. This causes the >>>>> c8 report tool to generate an invalid report. >>>>> >>>>> The above is what I observe on my company's codebase. I tried to >>>>> create simple reproductions that I could share, however all my simple >>>>> projects are working fine. >>>>> >>>>> Any suggestions or tips on what I could try to debug the problem would >>>>> be appreciated. >>>>> >>>>> (FYI ... here's a working version of the flow on a smaller project: >>>>> https://github.com/cek333/v8-chrome-coverage-wdio-sync) >>>>> >>>>> Thanks. >>>>> >>>>> -- >>>>> -- >>>>> v8-dev mailing list >>>>> [email protected] >>>>> 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 [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/v8-dev/22d16033-590f-4de3-86de-a6aa6ebcbb74n%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/v8-dev/22d16033-590f-4de3-86de-a6aa6ebcbb74n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >> -- >> v8-dev mailing list >> [email protected] >> 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 [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/v8-dev/45317061-acd7-42ac-973a-3e36b4687052n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/v8-dev/45317061-acd7-42ac-973a-3e36b4687052n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- -- v8-dev mailing list [email protected] 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/7a764f05-213d-48fc-96c6-bd5f0155a7ccn%40googlegroups.com.
