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

Method tryInitOrUpdate

src/frontend/rtos/rtos-common.ts:431–459  ·  view source on GitHub ↗
(useFrameId: number, opt?: boolean)

Source from the content-addressed store, hash-verified

429 }
430
431 public async tryInitOrUpdate(useFrameId: number, opt?: boolean): Promise<boolean> {
432 try {
433 if (this.rtos.progStatus !== 'stopped') {
434 return false;
435 }
436 const arg: DebugProtocol.EvaluateArguments = {
437 frameId: useFrameId,
438 expression: this.expression,
439 context: 'hover'
440 };
441 this.value = undefined;
442 // We have to see what a debugger like cppdbg returns for failures or when busy. And, is hover the right thing to use
443 const result = await this.rtos.customRequest('evaluate', arg, opt);
444 this.value = result.result;
445 this.varReference = result.variablesReference;
446 return true;
447 }
448 catch (e) {
449 const msg = e?.message as string;
450 if (msg) {
451 if ((msg === 'Busy') || // Cortex-Debug
452 (msg.includes('process is running'))) { // cppdbg
453 // For cppdbg, the whole message is 'Unable to perform this action because the process is running.'
454 return false;
455 }
456 }
457 throw e;
458 }
459 }
460
461 public getValue(frameId: number): Promise<string> {
462 return new Promise<string | undefined>(async (resolve, reject) => {

Callers 2

getVarIfEmptyFunction · 0.95
getValueMethod · 0.95

Calls 1

customRequestMethod · 0.65

Tested by

no test coverage detected