Bug 269306 - [debug view] Threads use the container name by mistake
Summary: [debug view] Threads use the container name by mistake
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 6.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 6.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2009-03-18 20:50 EDT by Marc Khouzam CLA
Modified: 2009-05-28 16:41 EDT (History)
2 users (show)

See Also:
cdtdoug: iplog-


Attachments
Fix (9.11 KB, patch)
2009-03-18 22:02 EDT, Marc Khouzam CLA
no flags Details | Diff
Updated checkProperty() (1.12 KB, patch)
2009-03-19 12:02 EDT, Marc Khouzam CLA
no flags Details | Diff
GDB-specific patch. (25.64 KB, patch)
2009-03-19 13:54 EDT, Pawel Piech CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2009-03-18 20:50:32 EDT
The label of a thread is the same as the container, instead of being "Thread [n]".
Probably related to the PropertyProvider changes.  I'll have a look, I expect it is simple (famous last words :-))
Comment 1 Marc Khouzam CLA 2009-03-18 22:02:47 EDT
Created attachment 129314 [details]
Fix

There was in fact a bug in the TreadVMNode which was getting the data of the process instead of the thread.

Then, the AbstractThreadVNNode LabelProvider did not yield the same format as what we used to have; it was missing the possibility to have both a threadId and an OSThreadId.

This patch fixes both issues and shows GDB Threads as before, i.e.,
Thread[<threadId>] <OSId> (Suspended : <Reason>)

I committed the change.  However, the LabelProvider format is part of DSF, so Pawel, let me know if you agree or not, and feel free to make or ask me to make changes.
Comment 2 Marc Khouzam CLA 2009-03-18 22:03:39 EDT
Pawel, can you review?
Comment 3 Marc Khouzam CLA 2009-03-19 11:19:52 EDT
This fix technically changes the API by adding two new plublic constants.  Also, I changed the format of messages.properties, which could technically break someone's previous usage of it.

I saw we still go ahead with it.
Do we need votes?
Comment 4 Marc Khouzam CLA 2009-03-19 12:02:27 EDT
Created attachment 129366 [details]
Updated checkProperty()

I forgot to update ExecutionContextLabelText#checkProperty() for the new ID2 property.

Committed.
Comment 5 Pawel Piech CLA 2009-03-19 12:31:39 EDT
I was actually going to re-work the patch so that it's GDB specific, since the view model is explicitly designed to be extendable and multiple id's per thread seem redundant for a general case.  I'll have a patch ready soon.
Comment 6 Pawel Piech CLA 2009-03-19 13:54:59 EDT
Created attachment 129379 [details]
GDB-specific patch.

This patch adds the second ID to the GDB threads node only.  It also adds a "state change reason known" property which simplifies the label provider logic somewhat.

I didn't commit the patch yet, because I want Marc to have a chance to review it first.
Comment 7 Pawel Piech CLA 2009-03-19 13:58:04 EDT
BTW, this is technically an API change, even though it's just provisional API.  But we're past API freeze so we should ask for review prior to committing.
Comment 8 Marc Khouzam CLA 2009-03-19 14:33:57 EDT
(In reply to comment #6) 
> This patch adds the second ID to the GDB threads node only. 

Thanks!

> It also adds a
> "state change reason known" property which simplifies the label provider logic
> somewhat.

That is much nicer.
 
> I didn't commit the patch yet, because I want Marc to have a chance to review
> it first.

Two comments:

1- In GdbExecutionContextLabelText#getPropertyValue(), don't you have to also check and return the value for IGdbLaunchVMConstants.PROP_OS_ID

2-  StackFramesVMNode_No_columns__No_function__text_format in messages.properties had been changed by Ken, but you changed it back.  I assume it was an accident, and that Ken was right.  The value of that message should be 
[{1}] at {0}
instead of
[{2}] at {0}
I'll let you fix that in your patch.

Besides those two point, everything looks good to me. 
Go ahead and commit.

Comment 9 Marc Khouzam CLA 2009-03-19 14:34:22 EDT
(In reply to comment #7)
> BTW, this is technically an API change, even though it's just provisional API. 
> But we're past API freeze so we should ask for review prior to committing.

+1 from me.

Comment 10 Marc Khouzam CLA 2009-03-19 14:37:48 EDT
I just noticed:

!ENTRY org.eclipse.osgi 2 1 2009-03-19 14:33:01.655
!MESSAGE NLS missing message: AbstractThreadVMNode_No_columns__No_reason__text_format in: org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.messages

!ENTRY org.eclipse.osgi 2 1 2009-03-19 14:33:02.045
!MESSAGE NLS missing message: ThreadVMNode_No_columns__No_reason__text_format in: org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.messages

You should remove ThreadVMNode_No_columns__No_reason__text_format from MessagesForGdbLaunchVM

and AbstractThreadVMNode_No_columns__No_reason__text_format from MessagesForLaunchVM
Comment 11 Pawel Piech CLA 2009-03-19 14:48:56 EDT
(In reply to comment #8)
> 1- In GdbExecutionContextLabelText#getPropertyValue(), don't you have to also
> check and return the value for IGdbLaunchVMConstants.PROP_OS_ID
No, super.getPropertyValue() will return null, if the property is not available which is fine since the message format checks for it.

> 2-  StackFramesVMNode_No_columns__No_function__text_format in
> messages.properties had been changed by Ken, but you changed it back.  I assume
> it was an accident, and that Ken was right.  The value of that message should
> be 
> [{1}] at {0}
> instead of
> [{2}] at {0}
> I'll let you fix that in your patch.
I missed that, thanks.

> Besides those two point, everything looks good to me. 
> Go ahead and commit.

I applied the patch.

(In reply to comment #10)
Fixed, thanks.