Description
openedon Oct 5, 2023
While implementing setVariable
for gdb, I came across a strange scenario.
Suppose there is some variable that has structure, so it has reported a non-zero variableReference
. Next, the client changes the value of this variable by sending setVariable
request (using the variable's parent and the variable's name). However, the new value does not have any children -- so it would report variableReference
as 0
. (This scenario can happen, e.g., in Rust debugging, where some variants of an enum
may hold a value and some may not.)
In this situation, the original variableReference
of the changed variable is no longer valid. However, nothing in the specification actually says this.
If any children of the variable were fetched, they may also have been assigned a non-zero variableReference
, which are now invalid. This sort of thing can also happen if an assignment removes elements from a vector.