-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
pkg/proc: implement composite literals #3691
Conversation
This change adds support for evaluating composite struct literals. Updates go-delve#1465
This change adds support for slice and array literals. Updates go-delve#1465
This change adds support for map literals. Fixes go-delve#1465
My use case is the original ask in #1465 - accessing map elements (e.g. a watch expression in vscode). I'm not sure how much value there is in map and slice literals (since those can't me map keys). The map literals my code makes are at least somewhat broken - they can't be iterated since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the wrong approach. It works if all you want to do with the literal is either nothing or a map lookup but taking its address, using it in assignments or passing them to function calls will be broken, either in obvious or subtle ways (for example if the return value of a function call is assigned to the field of a struct we need to make sure that any pointers it might contain are visible to the garbage collector of the target program).
With the way call injection currently works this is approximately impossible, which is why that issue hasn't been closed in such a long time. I've been working on making this possible however.
I assume it's the Variable construction in |
Basically, you are creating a Variable that can only be used in very specific expressions. As I said, there isn't a really way to make this work properly, at the moment. Sorry. |
Sure, I get that and I'm not surprised my 'solution' doesn't work. I'm not clear on what you'd prefer to do with this PR: close it or leave it open/as a draft until it can be done properly. It doesn't make much of a difference to me either way. |
You should close it, I already have a version privately that does this with the allocation and it's very different from this. |
@aarzilli are you planning to release your version? Is it possible to download it somewhere? |
This change implements composite literals for struct, slice, array, and map types.
Fixes #1465