(useFrameId: number, opt?: boolean)
| 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) => { |
no test coverage detected