Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341949 - [Pin&Clone] Pinned view not update when stepping/running
Summary: [Pin&Clone] Pinned view not update when stepping/running
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-05 13:53 EDT by Patrick Chuong CLA
Modified: 2020-09-04 15:18 EDT (History)
3 users (show)

See Also:


Attachments
patch for interface update (6.81 KB, patch)
2011-04-05 14:41 EDT, Patrick Chuong CLA
pchuong: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Chuong CLA 2011-04-05 13:53:21 EDT
I am seeing a problem with the pin and clone feature when cores/thread are grouped. Here is the scenario, pin Variables <1> view to threadA and Variables <2> view to threadB, than select the group and perform step/resume. The views should update when the threads are suspended, this is not the case at the moment.
Comment 1 Patrick Chuong CLA 2011-04-05 14:41:21 EDT
Created attachment 192587 [details]
patch for interface update

I have simplified the interface a bit more, removed the eventType parameter and added the newSelection parameter. Since we only need to blank the view or update the view with the new selection, it doesn't really need to have the eventType. If the selection parameter is null, than blank the view, otherwise pass the selection to the view.
Comment 2 Patrick Chuong CLA 2011-04-05 15:01:21 EDT
I am trying to work on the gdb-dsf case to refresh the view but not sure whether this is the right thing to do. When a pinned thread is suspended, I need to expand the thread and select the first stackframe to update the pinned view. However, the selection will be filtered by the SelectionPolicy and will not cause other non-pinned view to update.

Is this the right thing to do? 

Also, I have a multi-threaded program, when a process is suspended, only the first thread is expanded. Is there any issue to expand the other suspended threads?
Comment 3 Marc Khouzam CLA 2011-04-05 16:07:54 EDT
(In reply to comment #1)
> Created attachment 192587 [details]
> patch for interface update
> 
> I have simplified the interface a bit more, removed the eventType parameter and
> added the newSelection parameter. Since we only need to blank the view or
> update the view with the new selection, it doesn't really need to have the
> eventType. If the selection parameter is null, than blank the view, otherwise
> pass the selection to the view.

I like this version.  It is simpler and seems somewhat more future-proof by allowing to send in the new selection.
Comment 4 Marc Khouzam CLA 2011-04-05 16:13:48 EDT
(In reply to comment #2)
> I am trying to work on the gdb-dsf case to refresh the view but not sure
> whether this is the right thing to do. When a pinned thread is suspended, I
> need to expand the thread and select the first stackframe to update the pinned
> view. However, the selection will be filtered by the SelectionPolicy and will
> not cause other non-pinned view to update.
> 
> Is this the right thing to do? 
> 
> Also, I have a multi-threaded program, when a process is suspended, only the
> first thread is expanded. Is there any issue to expand the other suspended
> threads?

I don't think the pin&clone feature should modify the debug view expansion state.

Is there no other way to create a selection without actually causing the selection in the debug view?  Can't we create a selection ourselves using the debug context we want it to contain?
Comment 5 Patrick Chuong CLA 2011-04-05 16:20:30 EDT
(In reply to comment #4)
> I don't think the pin&clone feature should modify the debug view expansion
> state.
> Is there no other way to create a selection without actually causing the
> selection in the debug view?  Can't we create a selection ourselves using the
> debug context we want it to contain?

Dobrin and I don't really like this solution either. The debug view is lazy, inorder to retives the DMVMContext and the tree path to construct the selection, the node has to be expanded. Is there a way for gdb-dsf to returns the stackframe DMVMContext and it's tree path without expanding it? If there is a way, than we can create the selection ourselves.
Comment 6 Marc Khouzam CLA 2011-04-05 21:09:29 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > I don't think the pin&clone feature should modify the debug view expansion
> > state.
> > Is there no other way to create a selection without actually causing the
> > selection in the debug view?  Can't we create a selection ourselves using the
> > debug context we want it to contain?
> 
> Dobrin and I don't really like this solution either. The debug view is lazy,
> inorder to retives the DMVMContext and the tree path to construct the
> selection, the node has to be expanded. Is there a way for gdb-dsf to returns
> the stackframe DMVMContext and it's tree path without expanding it? If there is
> a way, than we can create the selection ourselves.

I don't know myself.  Maybe asking the list would prove more useful :-)

Can you explain why stepping a group changes the pin context?  I would think it would be the grouping operation that would cause trouble right away, no?
Comment 7 Patrick Chuong CLA 2011-04-06 09:50:31 EDT
(In reply to comment #6)
> I don't know myself.  Maybe asking the list would prove more useful :-)
> Can you explain why stepping a group changes the pin context?  I would think > it would be the grouping operation that would cause trouble right away, no?

Stepping does not really change the pin context. When we resume, the view is blank out, we need to update the view again when the stack is fully constructed.

Groupping does not blank out the view. Also, the pin context is remembered based on the session-process-threadId. Give this a try, pin an ungroup thread and than group it.
Comment 8 Patrick Chuong CLA 2011-04-06 10:14:07 EDT
(In reply to comment #6)
> I don't know myself.  Maybe asking the list would prove more useful :-)

There are two things that I don't know:

1. Why other threads are not expanded for gdb when I suspend the process? How come only the first thread?

2. How to retrives DMVMContext and node path without expanding the tree.

I guess you are referring to #2. Do you know the answer for #1?
Comment 9 Patrick Chuong CLA 2011-04-06 10:25:52 EDT
I have commit the "patch for interface update" path to HEAD.
Comment 10 Marc Khouzam CLA 2011-04-06 13:51:15 EDT
(In reply to comment #8)
> (In reply to comment #6)
> > I don't know myself.  Maybe asking the list would prove more useful :-)
> 
> There are two things that I don't know:
> 
> 1. Why other threads are not expanded for gdb when I suspend the process? How
> come only the first thread?

I think this is by design.  I can't find where this happens in the *VMNode classes though.  This was all done by Pawel and Toni I believe.
Comment 11 Marc Khouzam CLA 2011-04-06 13:53:43 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > I don't know myself.  Maybe asking the list would prove more useful :-)
> > Can you explain why stepping a group changes the pin context?  I would think
> > it would be the grouping operation that would cause trouble right away, no?
> 
> Stepping does not really change the pin context. When we resume, the view is
> blank out, we need to update the view again when the stack is fully
> constructed.

But the selection is the same as before, so that should work.

> Groupping does not blank out the view. Also, the pin context is remembered
> based on the session-process-threadId. Give this a try, pin an ungroup thread
> and than group it.

Right, once you group, the context hierarchy changes and will need to be changed in the pinned view.  Can't we construct the new selection based on the old selection and the new DMC hierarchy?
Comment 12 Patrick Chuong CLA 2011-04-06 14:52:35 EDT
(In reply to comment #10)
> I think this is by design.  I can't find where this happens in the *VMNode
> classes though.  This was all done by Pawel and Toni I believe.
Check the StackFramesVMNode#buildDelta line 649. How come only one threadDmc is return? Where I have an app that has multiple threads and they all suspended.

(In reply to comment #11)
> Right, once you group, the context hierarchy changes and will need to be
> changed in the pinned view.  Can't we construct the new selection based on the
> old selection and the new DMC hierarchy?
We don't really need the DMVMContext once the view is pinned, only the thread id is required. To recreate the selection from the old selection makes me worry, because what happend when I call to the old DMVMContext to retrive thread name, process, etc? Also, what do we do with the path in the selection? The object might have a different path if it is groupped. Not sure if a view will make use of the path from the selection at this point.