Bug 164044 - [view model] Move ThreadsVMNode and ContainerVMNode to the org.eclipse.dd.dsf.debug.ui plugin.
Summary: [view model] Move ThreadsVMNode and ContainerVMNode to the org.eclipse.dd.dsf...
Status: CLOSED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf (show other bugs)
Version: 0 DD 1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: DD 1.1   Edit
Assignee: Randy Rohrbach CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2006-11-09 18:57 EST by Pawel Piech CLA
Modified: 2009-01-07 17:35 EST (History)
2 users (show)

See Also:


Attachments
Refactoring of ThreadVMNode (33.59 KB, patch)
2008-05-20 05:05 EDT, Anton Leherbauer CLA
no flags Details | Diff
Reworked patch (+committed) (45.07 KB, patch)
2008-05-21 07:17 EDT, Anton Leherbauer CLA
pawel.1.piech: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Piech CLA 2006-11-09 18:57:05 EST
The ThreadsLayoutNode is meant to be the generic layout node based strictly on APIs in on org.eclipse.dd.dsf.debug.  But since the MI implementation is hard-coded to return a single thread, the ThreadsLayoutNode is stuck with a dependency on org.eclipse.dd.dsf.mi.

Along with making this move, the LaunchViewModelProvider can be extended to configure its layout.
Comment 1 Pawel Piech CLA 2008-05-15 14:39:28 EDT
ThreadsVMNode and ContainerVMNode are currently in GDB, there is a lot of code in them that is common to all debuggers, but there are parts of it that are necessarily debugger specific.  The best we ccan do is create abstract base classes of these two nodes and add them to org.eclipse.dd.dsf.debug.ui plugin, then extend these base classes in the GDB and PDE implementations.
Comment 2 Anton Leherbauer CLA 2008-05-16 07:59:47 EDT
I'll try to come up with a patch.
Comment 3 Pawel Piech CLA 2008-05-16 11:32:34 EDT
Thanks Toni,
Let's target this post 1.0.  We are going to branch 1.0 after RC1 so that we can continue active development in head.
Comment 4 Anton Leherbauer CLA 2008-05-20 05:05:28 EDT
Created attachment 101016 [details]
Refactoring of ThreadVMNode

This patch extracts the abstract base class AbstractThreadVMNode from ThreadVMNode.

I also looked at ContainerVMNode, but I don't see much code that can be shared, although there are some potential refactorings that could make sense, eg.

- Create interfaces for IContainer(Started|Exited)Event in IRunControl
- Let GDB's Inferior(Started|Exited)Event implement those interfaces
- Implement IRunControl.getExecutionData() in GDBRunControl such that it can be used as replacement for GDBRunControl.getThreadData() and GDBRunControl.getProcessData()

I think, this would help factoring out a common abstract imlementation of ContainerVMNode.
Comment 5 Pawel Piech CLA 2008-05-20 12:33:38 EDT
Thank you Toni,
The patch is exactly what I had in mind.  I only have a couple of comments:

1) I think we should leave out the implementation of IElementMementoProvider from the base class for now.  There is a separate bug (bug 231651), to abstract out this implementation into a lower-level base class, and we need to hash out what the protected method signature is going to be (async or sync).

2) The container could also be implemented using the IStated/IExitedDMEvent, because inferior process events do implement these as well.  The event handling could distinguish these by checking whether the started process is a container or not.  The other issue here is that there is no generic interface for GDBStartedEvent.  This event is handled in case of an attach to process, where an inferior process started event may not be generated.  I'm not sure if we really need a generic version of this event, for now we could just handle it in the GDB sub-class of the container vm node.
Comment 6 Anton Leherbauer CLA 2008-05-21 07:17:14 EDT
Created attachment 101222 [details]
Reworked patch (+committed)

Thanks, Pawel.
I have updated the patch with the suggested changes:
- moved implementation of IElementMementoProvider back to ThreadVMNode
- factored out AbstractContainerVMNode and implemented event handling as generic as possible
Comment 7 Pawel Piech CLA 2008-05-22 16:22:41 EDT
Thanks Toni,
I committed the updated patch (after merging in bug 233339). 
Randy please review.
Comment 8 Randy Rohrbach CLA 2008-05-23 09:13:56 EDT
Pawel

   The changes look OK except for the following

     ContainerVMNode's getDeltaFlags/buildDelta were handling the events

        InferiorExitedDMEvent * InferiorStartedDMEvent

     AbstractContainerVMNode is not handling them and they do not appear
     to be in ContainerVMNode anymore. Unless my diff is not showing me
     something.

     I will update from HEAD to be sure.

Randy
Comment 9 Anton Leherbauer CLA 2008-05-23 09:22:04 EDT
(In reply to comment #8)
> Pawel
> 
>    The changes look OK except for the following
> 
>      ContainerVMNode's getDeltaFlags/buildDelta were handling the events
> 
>         InferiorExitedDMEvent * InferiorStartedDMEvent
> 
>      AbstractContainerVMNode is not handling them and they do not appear
>      to be in ContainerVMNode anymore. Unless my diff is not showing me
>      something.
> 
>      I will update from HEAD to be sure.
> 
> Randy
> 

Hi Randy,
the container events are handled in the base class generically. The container events are distinguished from the thread events by looking at the execution context of the event. See also comment 5 pt.2.
Comment 10 Pawel Piech CLA 2008-05-23 18:44:29 EDT
(In reply to comment #9)
Agreed.  Randy, does this answer your question?
Comment 11 Pawel Piech CLA 2009-01-07 16:06:53 EST
DD 1.1 reelased!