Файли
openidea/e2e/debugFramesError.spec.ts
T
LU XIANGRUIтаwildcatDownstairs b30716e22c fix(debug): show Java frames when java-debug cannot describe one of them (#6158)
On Windows a Java debug session stopped in a Spring request showed no frames: with the
project's sourcePaths set, java-debug looks a CGLIB proxy frame's `<generated>` source up
there, Paths.get throws, and the adapter fails the whole stackTrace request. When that
request fails, the frames are now taken one at a time, leaving out the ones the adapter
can't describe. A stack trace failure that remains is logged and shown in Threads &
Variables with a Retry button instead of an empty list.

Fixes #6157

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-26 18:32:35 +08:00

43 рядки
2.0 KiB
TypeScript

import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("shows why the frames did not load and retries them", async ({ workbench: page }) => {
await page.setViewportSize({ width: 940, height: 740 });
await stubDesktop(page);
await page.evaluate(async () => {
const stateModule = "/src/features/debugger/state.ts";
const workbenchModule = "/src/workbench/contributions.ts";
const { adoptSession, handleDebugEvent } = await import(/* @vite-ignore */ stateModule);
const { toolWindowService } = await import(/* @vite-ignore */ workbenchModule);
const handlers = window.__ipc.handlers;
let failures = 1;
handlers.debug_stack_trace = () => {
if (failures-- > 0)
throw { kind: "protocol", message: "debug adapter did not answer `stackTrace` in time", detail: null };
return [{ id: 7, name: "OrderController.place(Order)", path: null, line: 41, column: 0, presentationHint: null }];
};
handlers.debug_threads = () => [{ id: 9, name: "http-nio-8080-exec-9" }];
handlers.debug_scopes = () => [];
adoptSession(98, { name: "Orders", adapter: "java-debug", status: "running" });
toolWindowService().show("debug", true);
handleDebugEvent(98, {
kind: "stopped",
threadId: 9,
allThreadsStopped: false,
reason: "breakpoint",
description: null,
});
});
const frames = page.getByRole("region", { name: "Debug", exact: true }).getByRole("listbox", { name: "Frames" });
const error = frames.getByRole("alert");
await expect(error).toContainText("Could not load the frames: debug adapter did not answer `stackTrace` in time");
await page.screenshot({ path: test.info().outputPath("frames-error.png") });
await error.getByRole("button", { name: "Retry" }).click();
await expect(frames.getByText("OrderController.place(Order)", { exact: true })).toBeVisible();
await expect(error).toBeHidden();
expect(await ipcCalls(page, "debug_stack_trace")).toEqual([
{ session: 98, threadId: 9 },
{ session: 98, threadId: 9 },
]);
});