-
Notifications
You must be signed in to change notification settings - Fork 131
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
Proposal: Support object IDs #134
Comments
@isadorasophia Thanks a lot for the new DAP feature proposal. Here are some initial comments and questions:
/cc @gregg-miskelly |
@weinand Thank you for the comments and suggestions! Here are my thoughts:
The object ID is merely a way of the debugger to track the value of a variable internally. We will pin that value so it is not garbage collected and persist outside its scope. For example, in the given program: class Foo
{
private readonly int _id;
public Foo(int id)
{
_id = id;
}
static void Main()
{
Foo foo = new Foo(0);
Debugger.Break();
bar();
}
static void bar()
{
Debugger.Break();
}
} If we start debugging and stop at the first breakpoint, we can create an object ID for
Afterwards, when stopping at bar(), This can be tied to any object that already exists in the debuggee (e.g. a local) or evaluated through a watch expression, which is the reason we also need a way to track objects created through expression evaluation:
Given what object IDs stand for, I am not sure whether it might add more confusion coming up with an alternate name. We are doing exactly what it describes: we are creating an object ID for that particular object, which will be persisted outside its scope as a reference to that object.
These are both already existing
The
Please let me know if you have any thoughts on the comments above! |
I think one thing that might not be obvious with this proposal is that the debug adapter directly communicates the created 'id' for the object to the user by modifying the displayed value. In Isa's example, the value of 'foo' goes from To try and clarify this, I would suggest adding something like the following to the documentation for
We probably want something similar for In terms of how a debug adapter would like to present object's which have an associated id to the user: under this proposal, since variable windows should be refreshed after creating the object id, that is up to the debug adapter. A debug adapter could certainly do it by adding a new scope to list all of the objects that have an object id. The C# debugger does it my adding a new fake local (in all functions), and by making |
Object IDs
When debugging managed code, users are able to track a certain variable outside its scope by creating an Object ID for it. An adapter can take this request and create an ID associated with the variable. It supports both variables created from an expression evaluation and an existing variable in the debuggee.
For expression evaluation results, we also extended
EvaluateResponse
with a reference identifier which can be used afterwards when referencing to the variable produced from that result. This is used when creating an ID for the evaluation result, but it can also be used with other features going forward.See the documentation for Track an out-of-scope object for more details.
CC: @andrewcrawley, @weinand
The text was updated successfully, but these errors were encountered: