eclipse-cdt-cloud / eclipse-cdt-cloud/vscode-memory-inspector

Refine Variable Tracker to make use of more hints from DAP Variable type

Open
#68 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
17
Forks
25
Avg merge
3d 22h
Merged PRs (30d)
8

Description

**Description**

The Memory Inspector has a variable tracker mechanism to determine valid variables and variable ranges for the Variable Decorator column. This works well in many cases. But the current implementation causes a few problems with some of our debug adapters.
* We have scopes that introduce artificial variables for grouping. For example by source file name.
* Some local variable locations depend on their lifetime and may not even live in memory but in registers.
* Depending on compiler toolchain and the optimization level of the application file build, there can be leftover symbols that have a bogus memory reference of `0x0`. Probably one of the things that won't be easy/possible to deal with on Memory Inspector side.

The above can result in failing evaluate requests. Causing error output in our implementations' Debug Console log.

I believe a refinement of the variable-to-range mapping making clever use of `memoryReference`, `value`, `type`, and/or other fields could reduce those errors. Also, we could skip address-of evaluate requests if we have a `memoryReference` that is a number. And skip size-of evaluate requests if the address-of request already failed. Only the latter would already reduce the error message by 50%.

**Additional information**

I've found a previous discussion between @thegecko and @colin-grant-work here: https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/pull/16#pullrequestreview-1383781446

This shows that we might need different variable tracker implementations depending on the debug adapters with built-in support: https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/blob/main/src/plugin/manifest.ts#L24
Which admittedly would be the least favored yet probably necessary approach. I also see that the variable tracker architecture is already prepared for such flavors.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.