Skip to content

Commit 5a375a1

Browse files
authored
Merge pull request #40 from nberth/show-globals
Show global data items in Variables panel
2 parents 85efda4 + 7a3baf0 commit 5a375a1

File tree

19 files changed

+1177
-177
lines changed

19 files changed

+1177
-177
lines changed

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"autoAttachChildProcesses": true,
2020
"sourceMaps": true,
2121
"outFiles": [
22-
"${workspaceFolder}/out/**/*.js"
22+
"${workspaceFolder}/**/*.(m|c|)js",
23+
"!**/node_modules/**"
2324
],
2425
"preLaunchTask": "npm"
2526
},

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Next
22

3+
* Show global data items in Variables panel [PR #40](https://github.com/ocamlpro/superbol-vscode-debug/pull/40)
34
* Fixed a bug that made the extension hang when debugged programs displayed signed numbers [PR #39](https://github.com/ocamlpro/superbol-vscode-debug/pull/39)
45
* Show COBOL statements in entries of stackframe summary [PR #38](https://github.com/ocamlpro/superbol-vscode-debug/pull/38)
56
* Remove `gdbpath` and `libcobpath` from launch configurations (these are provided in extension settings) [PR #36](https://github.com/ocamlpro/superbol-vscode-debug/pull/36)

src/debugger.ts

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ export interface Stack {
2323
line: Line;
2424
}
2525

26+
export interface FileSymbols {
27+
filename: string;
28+
fullname: string;
29+
symbols: Symbol[];
30+
}
31+
32+
export interface Symbol {
33+
line: number;
34+
name: string;
35+
type: string;
36+
description: string;
37+
}
38+
39+
export interface LocalizedSymbol {
40+
symbol: Symbol;
41+
filename: string;
42+
}
43+
44+
export function localizeSymbols(fileSymbols: FileSymbols): LocalizedSymbol[] {
45+
return fileSymbols.symbols.map(s => {
46+
return { symbol: s, filename: fileSymbols.filename }
47+
});
48+
}
49+
2650
const repeatTimeRegex = /(\"\,\s|^)\'(\s|0)\'\s\<repeats\s(\d+)\stimes\>/i;
2751

2852
export class CobolFieldDataParser {
@@ -395,19 +419,20 @@ export class Attribute {
395419

396420
export class DebuggerVariable {
397421

398-
public displayableType: string;
399-
public details: VariableDetail[];
422+
public readonly displayableType: string;
423+
public readonly details: VariableDetail[];
400424

401425
public constructor(
402-
public cobolName: string,
403-
public cName: string,
404-
public functionName: string,
405-
public rootFileC: string,
406-
public attribute: Attribute = null,
407-
public size: number = null,
426+
public readonly cobolName: string,
427+
public readonly cName: string,
428+
public readonly functionName: string,
429+
public readonly rootFileC: string,
430+
public readonly isField: boolean,
431+
public readonly attribute: Attribute = null,
432+
public readonly size: number = null,
408433
public value: string = null,
409434
public parent: DebuggerVariable = null,
410-
public children: Map<string, DebuggerVariable> = new Map<string, DebuggerVariable>()) {
435+
public readonly children: Map<string, DebuggerVariable> = new Map<string, DebuggerVariable>()) {
411436
[this.displayableType, this.details] = this.attribute.getDetails(this.size);
412437
}
413438

@@ -499,21 +524,24 @@ export interface IDebugger {
499524

500525
getStackVariables(thread: number, frame: number): Thenable<DebuggerVariable[]>;
501526

502-
evalExpression(name: string, thread: number, frame: number): Thenable<any>;
527+
globalStorageSymbols(): Thenable<FileSymbols[]>;
528+
529+
evalSymbol(s: LocalizedSymbol): Promise<DebuggerVariable>;
503530

504-
evalCobField(name: string, thread: number, frame: number): Promise<DebuggerVariable>;
531+
evalExpression(name: string, thread: number, frame: number): Promise<string>;
505532

506533
isReady(): boolean;
507534

508-
changeVariable(name: string, rawValue: string): Promise<any>;
535+
changeVariable(name: string, rawValue: string): Promise<Array<DebugProtocol.InvalidatedAreas>>;
536+
changeGlobalCVariable(cName: string, rawValue: string): Promise<Array<DebugProtocol.InvalidatedAreas>>;
509537

510538
examineMemory(from: number, to: number): Thenable<any>;
511539

512540
getGcovFiles(): string[];
513541

514542
sendUserInput(command: string, threadId: number, frameLevel: number): Thenable<any>;
515543

516-
getSourceMap(): SourceMap;
544+
sourceMap(): SourceMap;
517545
}
518546

519547
export class VariableObject {

src/extension.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ class GnuCOBOLEvalExpressionFactory implements EvaluatableExpressionProvider {
155155
return undefined;
156156
}
157157
// TODO: Do not use a global variable
158-
const variableName = globalThis.varGlobal.filter(it => it.children.toLowerCase() === txtToEval.toLowerCase());
159-
if(variableName && variableName.length>0){
160-
return new EvaluatableExpression(wordRange, variableName[0].father);
161-
}
158+
// Disabled for now...
159+
// const variableName = globalThis.varGlobal.filter(it => it.children.toLowerCase() === txtToEval.toLowerCase());
160+
// if(variableName && variableName.length>0){
161+
// return new EvaluatableExpression(wordRange, variableName[0].father);
162+
// }
162163
return wordRange ? new EvaluatableExpression(wordRange) : undefined;
163164
}
164165

0 commit comments

Comments
 (0)