-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine Variable Tracker to make use of more hints from DAP Variable type #68
Comments
Happy to take this one on myself and provide a PR for discussion when I have something that improves the situation. |
Is this a situation where a default implementation exists in the extension, but can be extended by other extensions? E.g. a debug adapter can register it's own tracker. |
I believe it will partly boil down to this. A few of the changes that I currently explore may still agree with the current But I think in the longer term a debug adapter may need to be able to override such parts with more specific knowledge about expression evaluation capabilities that go beyond the assumption of talking to a C/C++ debugger that supports |
I see now that #5 also mentions a potential contribution mechanism for the very same reasons. :-) |
I think some of the suggestions might be appropriate for implementation in the CTracker, but others should perhaps be placed in a separate contribution for debug adapters with specific behaviors.
This one is likely to be correct, and in line with the DAP's intended behavior. As implemented, the current behavior mostly reflects the behavior of the CDT-GDB adapter, which sends
I believe that at the moment these two requests are made concurrently, so we don't know whether one has succeeded before we make the other. I'd prefer to keep them concurrent for whatever speed increase that brings. If a different strategy is preferable for particular adapters, it may appropriate to implement a separate contribution for those adapters.
As you say, I think both of these may be tricky to handle on the Memory Inspector side. The former is part of the reason I added
This seems certainly to fall in the area of adapter-specific behavior, but there may be ways to filter these out in an upstream-friendly way; for example, we could reasonably decide to filter out any variable whose memory reference is a negative number. |
Thank you for your input, @colin-grant-work !
Yes, they happen concurrently and I appreciate the performance concerns. While this would work well enough in our case, it may cause performance degradation with other adapters. So, we need to be extra careful. Thanks for the hint with
This is actually an interesting idea. I was so far exploring if checking variable names for their compliance with C variable names would help to filter out such artificial variables. This would work well enough for filenames. But I am not fully convinced of that approach myself yet. The current implementation of |
I'm open to some intrusive changes in this area. I think deeper traversal of the tree is likely a good thing to implement, and if it lets us address other weaknesses at the same time, that's all to the good. There was just enough complexity to figuring out how to handle the various combinations of requests and available data that I shied away from it for the initial implementation. |
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.
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 amemoryReference
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: #16 (review)
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.
The text was updated successfully, but these errors were encountered: