Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"autoAttachChildProcesses": true,
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/out/**/*.js"
"${workspaceFolder}/**/*.(m|c|)js",
"!**/node_modules/**"
],
"preLaunchTask": "npm"
},
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Next

* Show global data items in Variables panel [PR #40](https://github.com/ocamlpro/superbol-vscode-debug/pull/40)
* 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)
* Show COBOL statements in entries of stackframe summary [PR #38](https://github.com/ocamlpro/superbol-vscode-debug/pull/38)
* Remove `gdbpath` and `libcobpath` from launch configurations (these are provided in extension settings) [PR #36](https://github.com/ocamlpro/superbol-vscode-debug/pull/36)
Expand Down
54 changes: 41 additions & 13 deletions src/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ export interface Stack {
line: Line;
}

export interface FileSymbols {
filename: string;
fullname: string;
symbols: Symbol[];
}

export interface Symbol {
line: number;
name: string;
type: string;
description: string;
}

export interface LocalizedSymbol {
symbol: Symbol;
filename: string;
}

export function localizeSymbols(fileSymbols: FileSymbols): LocalizedSymbol[] {
return fileSymbols.symbols.map(s => {
return { symbol: s, filename: fileSymbols.filename }
});
}

const repeatTimeRegex = /(\"\,\s|^)\'(\s|0)\'\s\<repeats\s(\d+)\stimes\>/i;

export class CobolFieldDataParser {
Expand Down Expand Up @@ -395,19 +419,20 @@ export class Attribute {

export class DebuggerVariable {

public displayableType: string;
public details: VariableDetail[];
public readonly displayableType: string;
public readonly details: VariableDetail[];

public constructor(
public cobolName: string,
public cName: string,
public functionName: string,
public rootFileC: string,
public attribute: Attribute = null,
public size: number = null,
public readonly cobolName: string,
public readonly cName: string,
public readonly functionName: string,
public readonly rootFileC: string,
public readonly isField: boolean,
public readonly attribute: Attribute = null,
public readonly size: number = null,
public value: string = null,
public parent: DebuggerVariable = null,
public children: Map<string, DebuggerVariable> = new Map<string, DebuggerVariable>()) {
public readonly children: Map<string, DebuggerVariable> = new Map<string, DebuggerVariable>()) {
[this.displayableType, this.details] = this.attribute.getDetails(this.size);
}

Expand Down Expand Up @@ -499,21 +524,24 @@ export interface IDebugger {

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

evalExpression(name: string, thread: number, frame: number): Thenable<any>;
globalStorageSymbols(): Thenable<FileSymbols[]>;

evalSymbol(s: LocalizedSymbol): Promise<DebuggerVariable>;

evalCobField(name: string, thread: number, frame: number): Promise<DebuggerVariable>;
evalExpression(name: string, thread: number, frame: number): Promise<string>;

isReady(): boolean;

changeVariable(name: string, rawValue: string): Promise<any>;
changeVariable(name: string, rawValue: string): Promise<Array<DebugProtocol.InvalidatedAreas>>;
changeGlobalCVariable(cName: string, rawValue: string): Promise<Array<DebugProtocol.InvalidatedAreas>>;

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

getGcovFiles(): string[];

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

getSourceMap(): SourceMap;
sourceMap(): SourceMap;
}

export class VariableObject {
Expand Down
9 changes: 5 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ class GnuCOBOLEvalExpressionFactory implements EvaluatableExpressionProvider {
return undefined;
}
// TODO: Do not use a global variable
const variableName = globalThis.varGlobal.filter(it => it.children.toLowerCase() === txtToEval.toLowerCase());
if(variableName && variableName.length>0){
return new EvaluatableExpression(wordRange, variableName[0].father);
}
// Disabled for now...
// const variableName = globalThis.varGlobal.filter(it => it.children.toLowerCase() === txtToEval.toLowerCase());
// if(variableName && variableName.length>0){
// return new EvaluatableExpression(wordRange, variableName[0].father);
// }
return wordRange ? new EvaluatableExpression(wordRange) : undefined;
}

Expand Down
Loading