Ely Ronnen 8b64cd8be2
[lldb-dap] Add module symbol table viewer to VS Code extension #140626 (#153836)
- VS Code extension:
- Add module symbol table viewer using
[Tabulator](https://tabulator.info/) for sorting and formatting rows.
  - Add context menu action to the modules tree.
 - lldb-dap
   -  Add `DAPGetModuleSymbolsRequest` to get symbols from a module.
 
Fixes #140626

[Screencast From 2025-08-15
19-12-33.webm](https://github.com/user-attachments/assets/75e2f229-ac82-487c-812e-3ea33a575b70)
2025-08-21 00:31:48 +02:00

78 lines
2.6 KiB
TypeScript

import * as path from "path";
import * as vscode from "vscode";
import { LLDBDapDescriptorFactory } from "./debug-adapter-factory";
import { DisposableContext } from "./disposable-context";
import { LaunchUriHandler } from "./uri-launch-handler";
import { LLDBDapConfigurationProvider } from "./debug-configuration-provider";
import { LLDBDapServer } from "./lldb-dap-server";
import { DebugSessionTracker } from "./debug-session-tracker";
import {
ModulesDataProvider,
ModuleProperty,
} from "./ui/modules-data-provider";
import { LogFilePathProvider } from "./logging";
import { SymbolsProvider } from "./ui/symbols-provider";
/**
* This class represents the extension and manages its life cycle. Other extensions
* using it as as library should use this class as the main entry point.
*/
export class LLDBDapExtension extends DisposableContext {
constructor(
context: vscode.ExtensionContext,
logger: vscode.LogOutputChannel,
logFilePath: LogFilePathProvider,
outputChannel: vscode.OutputChannel,
) {
super();
const lldbDapServer = new LLDBDapServer();
const sessionTracker = new DebugSessionTracker(logger);
this.pushSubscription(
logger,
outputChannel,
lldbDapServer,
sessionTracker,
vscode.debug.registerDebugConfigurationProvider(
"lldb-dap",
new LLDBDapConfigurationProvider(lldbDapServer, logger, logFilePath),
),
vscode.debug.registerDebugAdapterDescriptorFactory(
"lldb-dap",
new LLDBDapDescriptorFactory(logger, logFilePath),
),
vscode.debug.registerDebugAdapterTrackerFactory(
"lldb-dap",
sessionTracker,
),
vscode.window.registerTreeDataProvider(
"lldb-dap.modules",
new ModulesDataProvider(sessionTracker),
),
vscode.window.registerUriHandler(new LaunchUriHandler()),
);
this.pushSubscription(vscode.commands.registerCommand(
"lldb-dap.modules.copyProperty",
(node: ModuleProperty) => vscode.env.clipboard.writeText(node.value),
));
this.pushSubscription(new SymbolsProvider(sessionTracker, context));
}
}
/**
* This is the entry point when initialized by VS Code.
*/
export async function activate(context: vscode.ExtensionContext) {
const outputChannel = vscode.window.createOutputChannel("LLDB-DAP", { log: true });
outputChannel.info("LLDB-DAP extension activating...");
const logFilePath = new LogFilePathProvider(context, outputChannel);
context.subscriptions.push(
new LLDBDapExtension(context, outputChannel, logFilePath, outputChannel),
);
outputChannel.info("LLDB-DAP extension activated");
}