This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
The goal: The debug platform should support arbitrary debug architectures and
implementations of debuggers.
One possible implementation of a debugger is the “standard element and event based debug model” that exists today.
Hierarchy is based on IDebugTarget/IThread/IStackFrame… View update policy is based on events API is synchronous, but the UI should interact with it in an
asynchronous (non-blocking) fashion View wiring is based on stack frame selection Source lookup is based on stack frame selection
Debug platform provides a hierarchy of asynchronous viewers Asynchronous in the following ways:
Content retrieval Label generation Setting selection and expansion Update and refresh
We provide an abstract viewer and tree viewer
Based on JFace structured viewer Table viewer still to come (memory view) Tree viewer supports duplicate elements (variables view) Intend to support table trees
A specialized IAsynchronousRequestMonitor is used for each specific request to collect the results of a request.
E.g. IChildrenRequestMonitor.addChild(Object)/addChildren(Object[])
A status indicates success or failure
Allows for progress reporting and cancellation by the client fulfilling the request or making the request
Still investigating ability to retrieve only visible content for a viewer
One could imagine a request monitor that provides hints of how many children to retrieve, and also allow the UI to know how many children there are in total
An update policy updates elements in a viewer The default update policy is user driven (none)
When the input to a viewer is set, content is retrieved for the root element and children are displayed in the viewer
When a user clicks to expand a node, we retrieve more content An update policy allows model driven updates to be applied to a viewer
A model provides an IUpdatePolicyFactory adapter for its elements The factory is used to create an update policy for an element in a
specific presentation context
When an element is added to a viewer, its associated update policy (if any), is installed in the viewer. When the element is removed from the viewer, its update policy is removed (disposed).
An update policy is usually contributed only for the root element in a model (per view)
E.g., the update policy for a standard debug model is contributed for IDebugTarget. The update policy listens to events in that target only, and updates all elements in that model
An implementer could choose to contribute update policies for each of its elements
The debug platform contributes Debug view update policies for: ILaunchManager – updates as launches are registered
ILaunch – updates as process or debug target is added
Update policies are element based via adapters Allows for mixed models
I.e. the platform contributes update policies for the launch manager, a launch, and the standard debug target
The java debugger contributes an update policy for its additional lock and monitor elements, but it does not need to provide an update policy for the entire model
To support mixed models and update policies, an instance of a policy should only update elements in an instance of a model (for example, within a single debug target)
Avoids update policies stepping on each other
In the old world, there was one update policy that updated all models at once and caused all Debug views to synchronize
Update policies are an implementation detail We should not expose raw update policies to the user
We still want the user to be able to configure an update policy Actions and preferences can be used to configure an update policy
or update policy factory for a model For example, you could contribute a view action or preference setting
to toggle between ‘always update’ and ‘update every 5 seconds’. This action or preference would modify the way your update policy or update policy factory works
We will need an API to update/refresh update policies in a view
An update policy will usually expand and select elements in a viewer that are important – for example, selecting the top frame in a suspended thread.
How do we control selections within and across models as they all update in parallel?
IModelSelectionPolicy
An adapter that resolves selection collisions within a model When a selection is set and there is an existing selection in the
model, we can ask the selection policy to resolve a selection conflict with that model
When a selection is set and there is an existing selection in another model, we can ask the policy if the existing selection should be considered ‘sticky’ (i.e. override subsequent selections)
The active debug context drives debugging i.e. the selection in the Debug view drives
Action enablement (step, terminate, suspend, resume…) Source lookup and instruction pointers The variables and registers that are displayed The context used to evaluate an expression
Goals Users would like to be able to debug without the debug view open
Users would like to have multiple debug sessions active at once
Debug two sessions in different windows or in the same window with multiple Variable views linked to specific contexts
The debug platform needs to replace all of its element specific and event specific code with a layer of adapters that other models contribute.
This way the debug platform can interact with any implementation of a debugger based on these adapters
Note that many of the adapters are not debug specific
View content, label, update and selection policies are independent of debug (but we own the code)
We plan to maintain capability adapters with existing interfaces such as IStep, ITerminate, etc., except that implementors no longer need to fire events in underlying implementations.
It’s not clear that we need to replace these interfaces with equivalent ‘asynchronous request’ adapters
Flexible element hierarchies/content per element, per view Customized labels per element, per view Pluggable update policy per element, per view Pluggable source lookup Retargettable debug actions Flexible view wiring Debugging without the debug view Debugging simultaneous sessions in different views