MCPcopy Create free account
hub / github.com/Marus/cortex-debug / stackVariablesRequest

Method stackVariablesRequest

src/gdb.ts:2784–2816  ·  view source on GitHub ↗
(
        response: DebugProtocol.VariablesResponse,
        args: DebugProtocol.VariablesArguments
    )

Source from the content-addressed store, hash-verified

2782 }
2783
2784 private async stackVariablesRequest(
2785 response: DebugProtocol.VariablesResponse,
2786 args: DebugProtocol.VariablesArguments
2787 ): Promise<void> {
2788 response.body = { variables: [] };
2789 if (!this.isMIStatusStopped() || !this.stopped || this.disableSendStoppedEvents || this.continuing) {
2790 this.sendResponse(response);
2791 return;
2792 }
2793 const [threadId, frameId] = decodeReference(args.variablesReference);
2794 const variables: DebugProtocol.Variable[] = [];
2795 let stack: Variable[];
2796 try {
2797 await this.miDebugger.sendCommand(`stack-select-frame --thread ${threadId} ${frameId}`);
2798 stack = await this.miDebugger.getStackVariables(threadId, frameId);
2799 for (const variable of stack) {
2800 const varObjName = this.createStackVarName(variable.name, args.variablesReference);
2801 const tmp = await this.updateOrCreateVariable(variable.name, variable.name, varObjName, args.variablesReference, threadId, frameId, false);
2802 variables.push(tmp);
2803 }
2804 response.body = {
2805 variables: variables
2806 };
2807 this.sendResponse(response);
2808 }
2809 catch (err) {
2810 if (this.isMIStatusStopped()) { // Between the time we asked for a info, a continue occurred
2811 this.sendErrorResponse(response, 1, `Could not get stack variables: ${err}`);
2812 } else {
2813 this.sendResponse(response);
2814 }
2815 }
2816 }
2817
2818 private async variableMembersRequest(id: string, response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): Promise<void> {
2819 // Variable members

Callers 1

variablesRequestMethod · 0.95

Calls 6

isMIStatusStoppedMethod · 0.95
createStackVarNameMethod · 0.95
decodeReferenceFunction · 0.85
sendCommandMethod · 0.80
getStackVariablesMethod · 0.65

Tested by

no test coverage detected