[wasm][debugger] Add support for surfacing inherited members (#41480)
* [wasm][debugger][tests] Update to use `TDateTime` - this ensures that we check the datetime, and some property getters on it, wherever we have a datetime. * [wasm][debugger][tests] Add labels to more checks * [wasm][debugger] Add support for surfacing inherited members - surface inherited fields, and properties - we try to support `Runtime.getProperties`'s two arguments: - `ownProperties`, and `accessorsOnly` - `ownProperties`: for JS, this means return only the object's own members (not inherited ones) - `accessorsOnly`: for JS, this means return all the getters Actual implementation: - In practice, VSCode, and Chrome debugger seem to only send `{ ownProperties: true, accessorsOnly: false }`, and `{ ownProperties: false, accessorsOnly: true }`. The combination of which means - that we don't return any inherited fields! - But we want to show inherited fields too, so to get that behavior we essentially *ignore* `ownProperties`. IOW, - `ownProperties`: we return all fields, and properties - `accessorsOnly`: we return only the getters, including the inherited ones - Another thing to note is the case for auto-properties - these have a backing field - and we usually return the backing field's value, instead of returning a getter - To continue with that, auto-properties are *not* returned for `accessorsOnly` - The code in `mini-wasm-debugger.c` does handle these two arguments, but that is currently disabled by not passing the args to debugger.c at all - Instead, we get the *full* list of members, and try to filter it in `library_mono.js` - which includes handling property overrides, or shadowing by new properties/fields in derived classes * [wasm][debugger][tests] Fix simple warnings * [wasm][debugger][tests] Fix warnings introduced in this PR * [wasm][debugger][tests] Fix indentation * [wasm][debugger] Correctly handle local structs in async methods - When we have a struct local in an async instance method, it doesn't get expanded, since we have a containerId (the async object), and we can expand/access it later. - When the IDE asks us to expand it with `{accessorPropertiesOnly: true}`: - we get the expanded json, but `_filter_automatic_properties` tries to return just the accessors, but that doesn't handle the expanded members of nested structs! - That is done in `extract_and_cache_value_types`, which is run *after* `_filter_automatic_properties`, but by that time we have already lost the expanded members! - So, `_get_vt_properties` fails with `Unknown valuetype id`, because it doesn't have anything to return at that point. - This is being solved by ignoring the getProperties args in case of expanding valuetypes. - that means that we can correctly extract, and cache the whole object. - And after that, we can return accessors/others, based on the args. * [wasm][debugger] Fix warnings in debugger-test-app, and turn on warnAsError * For some cases, debugger seems to give the actual method name instead of MoveNext for async methods
Showing
想要评论请 注册 或 登录