feat(debugger): memory view for a paused JVM (#2648)

Adds a Memory tab to the Debug tool window for JVM sessions: loaded classes with instance counts and shallow sizes (with deltas between refreshes), read over the HotSpot attach listener (`GC.class_histogram`), falling back to counting reachable objects through the debugger on JDKs that cannot answer while suspended. While paused, a class's instances, an instance's fields and its referrers are listed through a JDWP link (the Kotlin adapter's path, and a jdtls bundle `java/jvm-inspect` for java-debug). Debug launches started by the IDE get `-XX:+StartAttachListener` unless the user's VM options decide otherwise (not on Windows).

New crates: ide-jdwp, ide-jvm-attach, ide-jvm-inspect. The bundled jar rebuilds byte-for-byte from build.py against the pinned JDT LS plugins.

Co-authored-by: ntbang0901 <[email protected]>
Цей коміт міститься в:
ntbang0901 authored and GitHub committed 2026-11-11 17:10:21 +08:00
1 джерело 0ff3f188de
коміт a3d1e57f3e
125 files changed
+16949 -307

No files matched your search

+216
Переглянути файл
@@ -0,0 +1,216 @@
.root {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
min-height: 0;
/* Shorter than the class table and the instances pane at their smallest: scroll rather than overlap. */
overflow-y: auto;
}
.toolbar {
flex: none;
display: flex;
align-items: center;
gap: 8px;
padding: 4px 8px;
border-bottom: 1px solid var(--border);
}
.filter {
flex: 0 1 240px;
min-width: 80px;
}
.banner,
.error {
flex: none;
padding: 4px 12px;
font-size: var(--fs-ui);
color: var(--fg);
border-bottom: 1px solid var(--border);
}
.banner {
background: var(--bg-feedback-warning);
border-bottom-color: var(--border-feedback-warning);
}
.error {
background: var(--bg-feedback-error);
border-bottom-color: var(--border-feedback-error);
-webkit-user-select: text;
user-select: text;
}
.note {
padding: 8px 12px;
color: var(--fg-subtle);
font-size: var(--fs-ui);
}
.table {
flex: 1;
/* Its header, three rows and the footer; the instances pane below gives way first. */
min-height: calc(2 * var(--h-row) + 3 * 22px);
/* Squeezed by the instances pane, it must not paint over it. */
overflow: hidden;
display: flex;
flex-direction: column;
--memory-columns: minmax(0, 1fr) 96px 72px 104px;
}
.noSizes {
--memory-columns: minmax(0, 1fr) 96px 72px;
}
.head,
.row {
display: grid;
grid-template-columns: var(--memory-columns);
align-items: center;
column-gap: 12px;
width: 100%;
}
.head {
flex: none;
height: var(--h-row);
padding: 0 16px 0 14px;
border-bottom: 1px solid var(--border);
color: var(--fg-muted);
font-size: var(--fs-small);
}
.headCell {
display: flex;
min-width: 0;
}
.headCell button {
flex: 1;
display: flex;
align-items: center;
gap: 4px;
min-width: 0;
height: 100%;
padding: 0;
color: inherit;
font: inherit;
white-space: nowrap;
text-align: left;
}
.headCell button:hover {
color: var(--fg-strong);
}
.headCell button:focus-visible {
outline: 2px solid var(--focus-ring);
outline-offset: -2px;
}
.numeric button {
justify-content: flex-end;
text-align: right;
}
.sorted button {
color: var(--fg-strong);
}
.grid {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
}
.headGroup {
flex: none;
}
.list {
flex: 1;
min-height: 0;
}
.row {
font-size: var(--fs-ui);
color: var(--fg);
}
.cell {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.className {
display: flex;
align-items: baseline;
gap: 8px;
min-width: 0;
font-family: var(--font-mono);
}
.classText {
flex: 0 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
color: var(--fg-strong);
}
.module {
flex: 1 100 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
color: var(--fg-subtle);
font-size: var(--fs-small);
}
.ambiguous {
flex: none;
align-self: center;
color: var(--warning);
}
.rowButton {
flex: none;
align-self: center;
margin-left: auto;
opacity: 0;
}
/* Outranks `.iconButton:disabled`, which would show it on every row while the program runs. */
.row .rowButton:disabled {
opacity: 0;
}
.row:hover .rowButton,
:global([data-lead]) > .row .rowButton,
.rowButton:focus-visible {
opacity: 1;
}
.row:hover .rowButton:disabled,
:global([data-lead]) > .row .rowButton:disabled {
opacity: 0.4;
}
.num {
text-align: right;
font-variant-numeric: tabular-nums;
}
.zero {
color: var(--fg-subtle);
}
.footer {
flex: none;
display: flex;
flex-wrap: wrap;
align-items: baseline;
column-gap: 12px;
padding: 4px 12px;
border-top: 1px solid var(--border);
color: var(--fg-muted);
font-size: var(--fs-small);
}
.source {
color: var(--fg-subtle);
}