Add valuesFormatting parameter to launch config
This commit is contained in:
parent
d498b381bf
commit
beb80f7375
7 changed files with 201 additions and 43 deletions
60
package.json
60
package.json
|
|
@ -101,6 +101,16 @@
|
||||||
"description": "Additional arguments to pass to GDB",
|
"description": "Additional arguments to pass to GDB",
|
||||||
"default": []
|
"default": []
|
||||||
},
|
},
|
||||||
|
"valuesFormatting": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
|
||||||
|
"default": "parseText",
|
||||||
|
"enum": [
|
||||||
|
"disabled",
|
||||||
|
"parseText",
|
||||||
|
"prettyPrinters"
|
||||||
|
]
|
||||||
|
},
|
||||||
"printCalls": {
|
"printCalls": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Prints all GDB calls to the console",
|
"description": "Prints all GDB calls to the console",
|
||||||
|
|
@ -192,6 +202,16 @@
|
||||||
"description": "If true this will connect to a gdbserver instead of attaching to a PID",
|
"description": "If true this will connect to a gdbserver instead of attaching to a PID",
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
|
"valuesFormatting": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
|
||||||
|
"default": "parseText",
|
||||||
|
"enum": [
|
||||||
|
"disabled",
|
||||||
|
"parseText",
|
||||||
|
"prettyPrinters"
|
||||||
|
]
|
||||||
|
},
|
||||||
"printCalls": {
|
"printCalls": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Prints all GDB calls to the console",
|
"description": "Prints all GDB calls to the console",
|
||||||
|
|
@ -466,6 +486,16 @@
|
||||||
"description": "Additional arguments to pass to LLDB",
|
"description": "Additional arguments to pass to LLDB",
|
||||||
"default": []
|
"default": []
|
||||||
},
|
},
|
||||||
|
"valuesFormatting": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
|
||||||
|
"default": "parseText",
|
||||||
|
"enum": [
|
||||||
|
"disabled",
|
||||||
|
"parseText",
|
||||||
|
"prettyPrinters"
|
||||||
|
]
|
||||||
|
},
|
||||||
"printCalls": {
|
"printCalls": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Prints all lldb calls to the console",
|
"description": "Prints all lldb calls to the console",
|
||||||
|
|
@ -552,6 +582,16 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "PID of running program or program name"
|
"description": "PID of running program or program name"
|
||||||
},
|
},
|
||||||
|
"valuesFormatting": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
|
||||||
|
"default": "parseText",
|
||||||
|
"enum": [
|
||||||
|
"disabled",
|
||||||
|
"parseText",
|
||||||
|
"prettyPrinters"
|
||||||
|
]
|
||||||
|
},
|
||||||
"printCalls": {
|
"printCalls": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Prints all LLDB calls to the console",
|
"description": "Prints all LLDB calls to the console",
|
||||||
|
|
@ -713,6 +753,16 @@
|
||||||
"description": "Additional arguments to pass to mago",
|
"description": "Additional arguments to pass to mago",
|
||||||
"default": []
|
"default": []
|
||||||
},
|
},
|
||||||
|
"valuesFormatting": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
|
||||||
|
"default": "parseText",
|
||||||
|
"enum": [
|
||||||
|
"disabled",
|
||||||
|
"parseText",
|
||||||
|
"prettyPrinters"
|
||||||
|
]
|
||||||
|
},
|
||||||
"printCalls": {
|
"printCalls": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Prints all mago calls to the console",
|
"description": "Prints all mago calls to the console",
|
||||||
|
|
@ -739,6 +789,16 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "PID of running program or program name"
|
"description": "PID of running program or program name"
|
||||||
},
|
},
|
||||||
|
"valuesFormatting": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Set the way of showing variable values. 'disabled' - show value as is, 'parseText' - parse debuggers output text into structure, 'prettyPrinters' - enable debuggers custom pretty-printers if there are any",
|
||||||
|
"default": "parseText",
|
||||||
|
"enum": [
|
||||||
|
"disabled",
|
||||||
|
"parseText",
|
||||||
|
"prettyPrinters"
|
||||||
|
]
|
||||||
|
},
|
||||||
"printCalls": {
|
"printCalls": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Prints all mago calls to the console",
|
"description": "Prints all mago calls to the console",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { MINode } from "./mi_parse";
|
import { MINode } from "./mi_parse";
|
||||||
import { DebugProtocol } from "vscode-debugprotocol/lib/debugProtocol";
|
import { DebugProtocol } from "vscode-debugprotocol/lib/debugProtocol";
|
||||||
|
|
||||||
|
export type ValuesFormattingMode = "disabled" | "parseText" | "prettyPrinters";
|
||||||
|
|
||||||
export interface Breakpoint {
|
export interface Breakpoint {
|
||||||
file?: string;
|
file?: string;
|
||||||
line?: number;
|
line?: number;
|
||||||
|
|
|
||||||
|
|
@ -196,9 +196,9 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
];
|
];
|
||||||
if (!attach)
|
if (!attach)
|
||||||
cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\""));
|
cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(target) + "\""));
|
||||||
|
if (this.prettyPrint)
|
||||||
// TODO: add extension parameter for enabling/disabling pretty printers
|
|
||||||
cmds.push(this.sendCommand("enable-pretty-printing"));
|
cmds.push(this.sendCommand("enable-pretty-printing"));
|
||||||
|
|
||||||
return cmds;
|
return cmds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -746,6 +746,7 @@ export class MI2 extends EventEmitter implements IBackend {
|
||||||
return this.isSSH ? this.sshReady : !!this.process;
|
return this.isSSH ? this.sshReady : !!this.process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prettyPrint: boolean = true;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
debugOutput: boolean;
|
debugOutput: boolean;
|
||||||
public procEnv: any;
|
public procEnv: any;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { MI2DebugSession } from './mibase';
|
||||||
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
||||||
import { DebugProtocol } from 'vscode-debugprotocol';
|
import { DebugProtocol } from 'vscode-debugprotocol';
|
||||||
import { MI2 } from "./backend/mi2/mi2";
|
import { MI2 } from "./backend/mi2/mi2";
|
||||||
import { SSHArguments } from './backend/backend';
|
import { SSHArguments, ValuesFormattingMode } from './backend/backend';
|
||||||
|
|
||||||
export interface LaunchRequestArguments {
|
export interface LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
|
@ -14,6 +14,7 @@ export interface LaunchRequestArguments {
|
||||||
terminal: string;
|
terminal: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
ssh: SSHArguments;
|
ssh: SSHArguments;
|
||||||
|
valuesFormatting: ValuesFormattingMode;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
showDevDebugOutput: boolean;
|
showDevDebugOutput: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -28,6 +29,7 @@ export interface AttachRequestArguments {
|
||||||
remote: boolean;
|
remote: boolean;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
ssh: SSHArguments;
|
ssh: SSHArguments;
|
||||||
|
valuesFormatting: ValuesFormattingMode;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
showDevDebugOutput: boolean;
|
showDevDebugOutput: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -54,6 +56,7 @@ class GDBDebugSession extends MI2DebugSession {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.crashed = false;
|
this.crashed = false;
|
||||||
this.debugReady = false;
|
this.debugReady = false;
|
||||||
|
this.setValuesFormattingMode(args.valuesFormatting);
|
||||||
this.miDebugger.printCalls = !!args.printCalls;
|
this.miDebugger.printCalls = !!args.printCalls;
|
||||||
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
||||||
if (args.ssh !== undefined) {
|
if (args.ssh !== undefined) {
|
||||||
|
|
@ -121,6 +124,7 @@ class GDBDebugSession extends MI2DebugSession {
|
||||||
this.needContinue = true;
|
this.needContinue = true;
|
||||||
this.isSSH = false;
|
this.isSSH = false;
|
||||||
this.debugReady = false;
|
this.debugReady = false;
|
||||||
|
this.setValuesFormattingMode(args.valuesFormatting);
|
||||||
this.miDebugger.printCalls = !!args.printCalls;
|
this.miDebugger.printCalls = !!args.printCalls;
|
||||||
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
||||||
if (args.ssh !== undefined) {
|
if (args.ssh !== undefined) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { MI2DebugSession } from './mibase';
|
||||||
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
||||||
import { DebugProtocol } from 'vscode-debugprotocol';
|
import { DebugProtocol } from 'vscode-debugprotocol';
|
||||||
import { MI2_LLDB } from "./backend/mi2/mi2lldb";
|
import { MI2_LLDB } from "./backend/mi2/mi2lldb";
|
||||||
import { SSHArguments } from './backend/backend';
|
import { SSHArguments, ValuesFormattingMode } from './backend/backend';
|
||||||
|
|
||||||
export interface LaunchRequestArguments {
|
export interface LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
|
@ -13,6 +13,7 @@ export interface LaunchRequestArguments {
|
||||||
arguments: string;
|
arguments: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
ssh: SSHArguments;
|
ssh: SSHArguments;
|
||||||
|
valuesFormatting: ValuesFormattingMode;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
showDevDebugOutput: boolean;
|
showDevDebugOutput: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -25,6 +26,7 @@ export interface AttachRequestArguments {
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
executable: string;
|
executable: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
valuesFormatting: ValuesFormattingMode;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
showDevDebugOutput: boolean;
|
showDevDebugOutput: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +51,7 @@ class LLDBDebugSession extends MI2DebugSession {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.crashed = false;
|
this.crashed = false;
|
||||||
this.debugReady = false;
|
this.debugReady = false;
|
||||||
|
this.setValuesFormattingMode(args.valuesFormatting);
|
||||||
this.miDebugger.printCalls = !!args.printCalls;
|
this.miDebugger.printCalls = !!args.printCalls;
|
||||||
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
||||||
if (args.ssh !== undefined) {
|
if (args.ssh !== undefined) {
|
||||||
|
|
@ -108,6 +111,7 @@ class LLDBDebugSession extends MI2DebugSession {
|
||||||
this.needContinue = true;
|
this.needContinue = true;
|
||||||
this.isSSH = false;
|
this.isSSH = false;
|
||||||
this.debugReady = false;
|
this.debugReady = false;
|
||||||
|
this.setValuesFormattingMode(args.valuesFormatting);
|
||||||
this.miDebugger.printCalls = !!args.printCalls;
|
this.miDebugger.printCalls = !!args.printCalls;
|
||||||
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
||||||
this.miDebugger.attach(args.cwd, args.executable, args.target).then(() => {
|
this.miDebugger.attach(args.cwd, args.executable, args.target).then(() => {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { MI2DebugSession } from './mibase';
|
||||||
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
||||||
import { DebugProtocol } from 'vscode-debugprotocol';
|
import { DebugProtocol } from 'vscode-debugprotocol';
|
||||||
import { MI2_Mago } from "./backend/mi2/mi2mago";
|
import { MI2_Mago } from "./backend/mi2/mi2mago";
|
||||||
import { SSHArguments } from './backend/backend';
|
import { SSHArguments, ValuesFormattingMode } from './backend/backend';
|
||||||
|
|
||||||
export interface LaunchRequestArguments {
|
export interface LaunchRequestArguments {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
|
@ -12,6 +12,7 @@ export interface LaunchRequestArguments {
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
arguments: string;
|
arguments: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
valuesFormatting: ValuesFormattingMode;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
showDevDebugOutput: boolean;
|
showDevDebugOutput: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -24,6 +25,7 @@ export interface AttachRequestArguments {
|
||||||
debugger_args: string[];
|
debugger_args: string[];
|
||||||
executable: string;
|
executable: string;
|
||||||
autorun: string[];
|
autorun: string[];
|
||||||
|
valuesFormatting: ValuesFormattingMode;
|
||||||
printCalls: boolean;
|
printCalls: boolean;
|
||||||
showDevDebugOutput: boolean;
|
showDevDebugOutput: boolean;
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +58,7 @@ class MagoDebugSession extends MI2DebugSession {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.crashed = false;
|
this.crashed = false;
|
||||||
this.debugReady = false;
|
this.debugReady = false;
|
||||||
|
this.setValuesFormattingMode(args.valuesFormatting);
|
||||||
this.miDebugger.printCalls = !!args.printCalls;
|
this.miDebugger.printCalls = !!args.printCalls;
|
||||||
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
||||||
this.miDebugger.load(args.cwd, args.target, args.arguments, undefined).then(() => {
|
this.miDebugger.load(args.cwd, args.target, args.arguments, undefined).then(() => {
|
||||||
|
|
@ -83,6 +86,7 @@ class MagoDebugSession extends MI2DebugSession {
|
||||||
this.needContinue = true;
|
this.needContinue = true;
|
||||||
this.isSSH = false;
|
this.isSSH = false;
|
||||||
this.debugReady = false;
|
this.debugReady = false;
|
||||||
|
this.setValuesFormattingMode(args.valuesFormatting);
|
||||||
this.miDebugger.printCalls = !!args.printCalls;
|
this.miDebugger.printCalls = !!args.printCalls;
|
||||||
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
this.miDebugger.debugOutput = !!args.showDevDebugOutput;
|
||||||
this.miDebugger.attach(args.cwd, args.executable, args.target).then(() => {
|
this.miDebugger.attach(args.cwd, args.executable, args.target).then(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
import { DebugSession, InitializedEvent, TerminatedEvent, StoppedEvent, OutputEvent, Thread, StackFrame, Scope, Source, Handles } from 'vscode-debugadapter';
|
||||||
import { DebugProtocol } from 'vscode-debugprotocol';
|
import { DebugProtocol } from 'vscode-debugprotocol';
|
||||||
import { Breakpoint, IBackend, Variable, VariableObject } from './backend/backend';
|
import { Breakpoint, IBackend, Variable, VariableObject, ValuesFormattingMode } from './backend/backend';
|
||||||
import { MINode } from './backend/mi_parse';
|
import { MINode } from './backend/mi_parse';
|
||||||
import { expandValue, isExpandable } from './backend/gdb_expansion';
|
import { expandValue, isExpandable } from './backend/gdb_expansion';
|
||||||
import { MI2 } from './backend/mi2/mi2';
|
import { MI2 } from './backend/mi2/mi2';
|
||||||
|
|
@ -24,6 +24,7 @@ const VAR_HANDLES_START = 2000;
|
||||||
export class MI2DebugSession extends DebugSession {
|
export class MI2DebugSession extends DebugSession {
|
||||||
protected variableHandles = new Handles<string | VariableObject | ExtendedVariable>(VAR_HANDLES_START);
|
protected variableHandles = new Handles<string | VariableObject | ExtendedVariable>(VAR_HANDLES_START);
|
||||||
protected variableHandlesReverse: { [id: string]: number } = {};
|
protected variableHandlesReverse: { [id: string]: number } = {};
|
||||||
|
protected useVarObjects: boolean;
|
||||||
protected quit: boolean;
|
protected quit: boolean;
|
||||||
protected attached: boolean;
|
protected attached: boolean;
|
||||||
protected needContinue: boolean;
|
protected needContinue: boolean;
|
||||||
|
|
@ -82,6 +83,23 @@ export class MI2DebugSession extends DebugSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected setValuesFormattingMode(mode: ValuesFormattingMode) {
|
||||||
|
switch (mode) {
|
||||||
|
case "disabled":
|
||||||
|
this.useVarObjects = true;
|
||||||
|
this.miDebugger.prettyPrint = false;
|
||||||
|
break;
|
||||||
|
case "prettyPrinters":
|
||||||
|
this.useVarObjects = true;
|
||||||
|
this.miDebugger.prettyPrint = true;
|
||||||
|
break;
|
||||||
|
case "parseText":
|
||||||
|
default:
|
||||||
|
this.useVarObjects = false;
|
||||||
|
this.miDebugger.prettyPrint = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected handleMsg(type: string, msg: string) {
|
protected handleMsg(type: string, msg: string) {
|
||||||
if (type == "target")
|
if (type == "target")
|
||||||
type = "stdout";
|
type = "stdout";
|
||||||
|
|
@ -132,6 +150,7 @@ export class MI2DebugSession extends DebugSession {
|
||||||
|
|
||||||
protected async setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): Promise<void> {
|
protected async setVariableRequest(response: DebugProtocol.SetVariableResponse, args: DebugProtocol.SetVariableArguments): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
if (this.useVarObjects) {
|
||||||
let name = args.name;
|
let name = args.name;
|
||||||
if (args.variablesReference >= VAR_HANDLES_START) {
|
if (args.variablesReference >= VAR_HANDLES_START) {
|
||||||
const parent = this.variableHandles.get(args.variablesReference) as VariableObject;
|
const parent = this.variableHandles.get(args.variablesReference) as VariableObject;
|
||||||
|
|
@ -142,6 +161,13 @@ export class MI2DebugSession extends DebugSession {
|
||||||
response.body = {
|
response.body = {
|
||||||
value: res.result("value")
|
value: res.result("value")
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await this.miDebugger.changeVariable(args.name, args.value);
|
||||||
|
response.body = {
|
||||||
|
value: args.value
|
||||||
|
};
|
||||||
|
}
|
||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -307,6 +333,7 @@ export class MI2DebugSession extends DebugSession {
|
||||||
try {
|
try {
|
||||||
stack = await this.miDebugger.getStackVariables(this.threadID, id);
|
stack = await this.miDebugger.getStackVariables(this.threadID, id);
|
||||||
for (const variable of stack) {
|
for (const variable of stack) {
|
||||||
|
if (this.useVarObjects) {
|
||||||
try {
|
try {
|
||||||
let varObj: VariableObject;
|
let varObj: VariableObject;
|
||||||
try {
|
try {
|
||||||
|
|
@ -337,6 +364,29 @@ export class MI2DebugSession extends DebugSession {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (variable.valueStr !== undefined) {
|
||||||
|
let expanded = expandValue(createVariable, `{${variable.name}=${variable.valueStr})`, "", variable.raw);
|
||||||
|
if (expanded) {
|
||||||
|
if (typeof expanded[0] == "string")
|
||||||
|
expanded = [
|
||||||
|
{
|
||||||
|
name: "<value>",
|
||||||
|
value: prettyStringArray(expanded),
|
||||||
|
variablesReference: 0
|
||||||
|
}
|
||||||
|
];
|
||||||
|
variables.push(expanded[0]);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
variables.push({
|
||||||
|
name: variable.name,
|
||||||
|
type: variable.type,
|
||||||
|
value: "<unknown>",
|
||||||
|
variablesReference: createVariable(variable.name)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
response.body = {
|
response.body = {
|
||||||
variables: variables
|
variables: variables
|
||||||
};
|
};
|
||||||
|
|
@ -346,6 +396,39 @@ export class MI2DebugSession extends DebugSession {
|
||||||
this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`);
|
this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (typeof id == "string") {
|
||||||
|
// Variable members
|
||||||
|
let variable;
|
||||||
|
try {
|
||||||
|
variable = await this.miDebugger.evalExpression(JSON.stringify(id));
|
||||||
|
try {
|
||||||
|
let expanded = expandValue(createVariable, variable.result("value"), id, variable);
|
||||||
|
if (!expanded) {
|
||||||
|
this.sendErrorResponse(response, 2, `Could not expand variable`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (typeof expanded[0] == "string")
|
||||||
|
expanded = [
|
||||||
|
{
|
||||||
|
name: "<value>",
|
||||||
|
value: prettyStringArray(expanded),
|
||||||
|
variablesReference: 0
|
||||||
|
}
|
||||||
|
];
|
||||||
|
response.body = {
|
||||||
|
variables: expanded
|
||||||
|
};
|
||||||
|
this.sendResponse(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
this.sendErrorResponse(response, 2, `Could not expand variable: ${e}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
this.sendErrorResponse(response, 1, `Could not expand variable: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (typeof id == "object") {
|
else if (typeof id == "object") {
|
||||||
if (id instanceof VariableObject) {
|
if (id instanceof VariableObject) {
|
||||||
// Variable members
|
// Variable members
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue