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

Method staticVariablesRequest

src/gdb.ts:2724–2757  ·  view source on GitHub ↗
(
        threadId: number,
        frameId: number,
        response: DebugProtocol.VariablesResponse,
        args: DebugProtocol.VariablesArguments
    )

Source from the content-addressed store, hash-verified

2722 }
2723
2724 private async staticVariablesRequest(
2725 threadId: number,
2726 frameId: number,
2727 response: DebugProtocol.VariablesResponse,
2728 args: DebugProtocol.VariablesArguments
2729 ): Promise<void> {
2730 const statics: DebugProtocol.Variable[] = [];
2731 try {
2732 const frame = await this.miDebugger.getFrame(threadId, frameId);
2733 let file = frame.file; // Prefer full path name first
2734 let staticNames = file ? await this.symbolTable.getStaticVariableNames(file) : null;
2735 if (!staticNames) {
2736 file = frame.fileName;
2737 staticNames = file ? await this.symbolTable.getStaticVariableNames(file) : [];
2738 }
2739
2740 const hasher = crypto.createHash('sha256');
2741 hasher.update(file || '');
2742 const fHash = hasher.digest('hex');
2743
2744 for (const displayName of staticNames) {
2745 const exprName = `'${file}'::${displayName}`;
2746 const varObjName = this.createStaticVarName(fHash, exprName);
2747 const tmp = await this.updateOrCreateVariable(displayName, exprName, varObjName, args.variablesReference, threadId, frameId, true);
2748 statics.push(tmp);
2749 }
2750
2751 response.body = { variables: statics };
2752 this.sendResponse(response);
2753 }
2754 catch (err) {
2755 this.sendErrorResponse(response, 1, `Could not get static variable information: ${err}`);
2756 }
2757 }
2758
2759 private createVariable(arg, options?): number {
2760 if (options) {

Callers 1

variablesRequestMethod · 0.95

Calls 5

createStaticVarNameMethod · 0.95
getFrameMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected