This is an archive of the discontinued LLVM Phabricator instance.

Send statistics in initialized event
ClosedPublic

Authored by GeorgeHuyubo on Nov 15 2022, 4:31 PM.

Details

Summary

This patch include change to send statistic in intialized event. Dependency diff: https://reviews.llvm.org/D137665
This change will give VSCode side the opportunity to warn users of zero/large debug info right after their debug sessions are launched.

The DAP initialized event should look like

{
  "event":"initialized",
  "seq":0,
  "statistics": {
    "memory": <JSON string>
    "targets": <JSON string>, // it's a JSON array, breakpoints info included in each target
    <metadata_key: value> // pairs
  },
  "type":"event"
}

Refactored the test: rename it to eventStatistic and test both initialized event and terminated event. Reuse some code.

Diff Detail

Event Timeline

GeorgeHuyubo created this revision.Nov 15 2022, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2022, 4:31 PM
GeorgeHuyubo requested review of this revision.Nov 15 2022, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2022, 4:31 PM
GeorgeHuyubo edited the summary of this revision. (Show Details)Nov 15 2022, 4:38 PM
yinghuitan accepted this revision.Nov 15 2022, 5:53 PM
This revision is now accepted and ready to land.Nov 15 2022, 5:53 PM
This revision was automatically updated to reflect the committed changes.

This test fails on Arm/AArch64 Linux. I have marked it as an XFAIL.

labath added a subscriber: labath.Nov 16 2022, 3:24 AM

It fails on all linux bots, so I've reverted it for now.

From what I can tell, the problem is that linux does not immediately (before running the process) load the shared library, and so the overall startup debug info size is reported as zero (because the main executable is stripped). It doesn't seem like this test really needs shared libraries, so maybe the simplest way to fix it would be to use an unstripped executable.

Yeah, sending this data at the entry point is not a good way to tell anything about the debug session having debug info. Some shared libraries might be loaded on macOS, but not on linux or android.