Skip to content

Commit 33f9b1c

Browse files
committed
Merge branch 'topic/debugConfig' into 'master'
Add basic support of Ada debugging in vscode See merge request eng/ide/ada_language_server!1273
2 parents da82f75 + 75ac8d3 commit 33f9b1c

File tree

8 files changed

+436
-33
lines changed

8 files changed

+436
-33
lines changed

.vscode/launch.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,24 @@
44
"version": "0.2.0",
55
"configurations": [
66
{
7-
"type": "gdb",
7+
"name": "(gdb) Attach",
8+
"type": "cppdbg",
89
"request": "attach",
9-
"name": "Attach to PID",
10-
"target": "${input:pid}",
11-
"cwd": "${workspaceRoot}",
12-
"valuesFormatting": "parseText"
10+
"program": "${workspaceFolder}/integration/vscode/ada/x64/linux/ada_language_server",
11+
"processId": "${command:pickProcess}",
12+
"MIMode": "gdb",
13+
"setupCommands": [
14+
{
15+
"description": "Enable pretty-printing for gdb",
16+
"text": "-enable-pretty-printing",
17+
"ignoreFailures": true
18+
},
19+
{
20+
"description": "Set Disassembly Flavor to Intel",
21+
"text": "-gdb-set disassembly-flavor intel",
22+
"ignoreFailures": true
23+
}
24+
]
1325
},
1426
{
1527
"type": "gdb",

integration/vscode/ada/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,37 @@
581581
}
582582
]
583583
}
584+
],
585+
"debuggers": [
586+
{
587+
"type": "ada",
588+
"label": "Ada",
589+
"languages": [
590+
"ada",
591+
"gpr",
592+
"GNAT Project"
593+
],
594+
"when": "ADA_PROJECT_CONTEXT",
595+
"configurationSnippets": [
596+
{
597+
"label": "Ada: Debugger Launch",
598+
"description": "Launch configuration for Ada debugging.",
599+
"body": {
600+
"type": "cppdbg",
601+
"request": "launch",
602+
"name": "Ada: Debugger Launch",
603+
"program": "^\"\\${workspaceFolder}/\\${command:ada.getOrAskForProgram}\"",
604+
"args": [],
605+
"cwd": "^\"\\${workspaceFolder}\"",
606+
"stopAtEntry": false,
607+
"preLaunchTask": "ada: Build current project"
608+
}
609+
}
610+
],
611+
"variables": {
612+
"AskForProgram": "ada.getOrAskForProgram"
613+
}
614+
}
584615
]
585616
},
586617
"devDependencies": {

integration/vscode/ada/src/commands.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import * as vscode from 'vscode';
22
import { SymbolKind } from 'vscode';
3-
import { getEnclosingSymbol } from './gnatTaskProvider';
4-
import { mainLogChannel } from './extension';
53
import { ContextClients } from './clients';
4+
import { getOrAskForProgram } from './debugConfigProvider';
5+
import { mainLogChannel } from './extension';
6+
import { getEnclosingSymbol } from './gnatTaskProvider';
67

7-
export function RegisterCommands(context: vscode.ExtensionContext, clients: ContextClients) {
8+
export function registerCommands(context: vscode.ExtensionContext, clients: ContextClients) {
89
context.subscriptions.push(
910
vscode.commands.registerCommand('ada.otherFile', clients.otherFileHandler)
1011
);
@@ -24,6 +25,15 @@ export function RegisterCommands(context: vscode.ExtensionContext, clients: Cont
2425
clients.gprClient.outputChannel.show()
2526
)
2627
);
28+
29+
// This is a hidden command that gets called in the default debug
30+
// configuration snippet that gets offered in the launch.json file.
31+
context.subscriptions.push(
32+
vscode.commands.registerCommand('ada.getOrAskForProgram', async () => {
33+
const p = await getOrAskForProgram();
34+
return p;
35+
})
36+
);
2737
}
2838
/**
2939
* Add a subprogram box above the subprogram enclosing the cursor's position, if any.

0 commit comments

Comments
 (0)