1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
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");
}
|