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

Method addOne

src/gdb.ts:2953–2994  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2951 this.sendResponse(response);
2952 };
2953 const addOne = async () => {
2954 const variable = await this.miDebugger.evalExpression(JSON.stringify(`${varReq.name}+${arrIndex})`), -1, -1);
2955 try {
2956 const expanded = expandValue(this.createVariable.bind(this), variable.result('value'), varReq.name, variable);
2957 if (!expanded) {
2958 this.sendErrorResponse(response, 15, 'Could not expand variable');
2959 }
2960 else {
2961 if (typeof expanded === 'string') {
2962 if (expanded === '<nullptr>') {
2963 if (argsPart) { argsPart = false; }
2964 else { return submit(); }
2965 }
2966 else if (expanded[0] !== '"') {
2967 strArr.push({
2968 name: '[err]',
2969 value: expanded,
2970 variablesReference: 0
2971 });
2972 return submit();
2973 }
2974 strArr.push({
2975 name: `[${(arrIndex++)}]`,
2976 value: expanded,
2977 variablesReference: 0
2978 });
2979 addOne();
2980 }
2981 else {
2982 strArr.push({
2983 name: '[err]',
2984 value: expanded,
2985 variablesReference: 0
2986 });
2987 submit();
2988 }
2989 }
2990 }
2991 catch (e) {
2992 this.sendErrorResponse(response, 14, `Could not expand variable: ${e}`);
2993 }
2994 };
2995 addOne();
2996 }
2997 else {

Callers

nothing calls this directly

Calls 3

expandValueFunction · 0.90
resultMethod · 0.80
evalExpressionMethod · 0.65

Tested by

no test coverage detected