Bug 404565 - [visualizer] Thread synchronization from multicore visualizer to debug view only works for first session
Summary: [visualizer] Thread synchronization from multicore visualizer to debug view o...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.2   Edit
Assignee: Marc Dumais CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-28 10:52 EDT by Marc Dumais CLA
Modified: 2013-04-01 11:34 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Dumais CLA 2013-03-28 10:52:35 EDT
When threads are selected and/or unselected in the multicore visualizer, the selection is synchronized in the debug view.   I noticed that this only seems to work for the first debug session, however.   Not the first session created, but whatever session is the first (topmost in the debug view) at any given moment.

After a bit of investigation, I think the reason is how DebugViewTreeWalker.getRootPath() is implemented.

Consider the following line from that method: 

Object root = (items == null || items.length == 0) ? null : items[0].getData();

It seems that each debug session has its entry in the "items" array above.  So, in the current code, only the first session is considered.

To give a bit of context, here is the whole method:

	public TreePath getRootPath()
	{
		// (?) This doesn't always return the expected root element.
		//return m_viewer.getTopElementPath();
		
		TreePath path = null;
		if (m_viewer != null) {
			Tree tree = (Tree) m_viewer.getControl();
			TreeItem[] items = tree.getItems();
			Object root = (items == null || items.length == 0) ? null : items[0].getData();
			if (root != null) path = new TreePath(new Object[] {root});
		}
		return path;
	}
Comment 1 Marc Dumais CLA 2013-03-28 11:48:49 EDT
Hi,

Here is a proposed patch for this bug:

https://git.eclipse.org/r/11547

Basically I did a small update so that getRootPath() now returns an array of root paths, each one being the root for a debug session.  Also the walk() method iterates through all those paths.  The effect is that all sessions are now walked, not just the first one.

----------------

w/r to the patch submitted in this bug, I declare the following:

1) that I am authorized to submit this code change
2) that the code is 100% my own work

Marc Dumais
Comment 2 William Swanson CLA 2013-04-01 10:56:09 EDT
Change submitted through Gerrit.