Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330289

Summary: [variables] Race condition when updating a variable object
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, jens.elmenthaler, pawel.1.piech
Version: 8.0   
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix marc.khouzam: iplog-

Description Marc Khouzam CLA 2010-11-15 15:59:59 EST
I noticed with this simple code

	int a[2] = {0,1};
	return a[0];

that if I show the variable view and expand 'a' on line 1 and then step to line 2, the content of a[0] and a[1] does not always show properly.

I tracked it down to a race condition that was introduced in the pretty-printing effort, within the state change of the variable object.  I'm working on a patch now.
Comment 1 Marc Khouzam CLA 2010-11-17 16:29:11 EST
Created attachment 183352 [details]
Fix

Because we now have a async call when receiving the answer to -var-update, we cannot immediately change the state from STATE_UPDATING to STATE_READY.  We have to wait until the async call is completed to set the state, so that we ensure the varObj is not read before we've finished processing the result of -var-update.

Committed to HEAD.

Jens, does it look good to you?
Comment 2 Marc Khouzam CLA 2010-11-17 16:30:16 EST
Fixed
Comment 3 CDT Genie CLA 2010-11-17 17:23:02 EST
*** cdt cvs genie on behalf of mkhouzam ***
Bug 330289: [variables] Race condition when updating a variable object

[*] MIVariableManager.java 1.17 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIVariableManager.java?root=Tools_Project&r1=1.16&r2=1.17
Comment 4 Jens Elmenthaler CLA 2010-11-18 10:32:12 EST
(In reply to comment #1)
> Created an attachment (id=183352) [details]
> Fix
...
> Jens, does it look good to you?
Yes, looks much better now. Thanks.