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

Bug 312519

Summary: [expressions] Display as Array fails for non-pointers
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Project Inbox <cdt-debug-dsf-gdb-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: enhancement    
Priority: P3 CC: abeerbagul, aegges, pawel.1.piech, shaijupnairp
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
"Display as array" should be visible only for pointer type variables none

Description Marc Khouzam CLA 2010-05-11 20:30:01 EDT
When we use the "display as array" on a non-pointer, we ask gdb to read memory from something that is not an address and it fails.  CDI does the same.

We can solve this in two ways:
1- only allow Display As Array on pointers (disable if not a pointer)
2- when not a pointer, use the address of the non-pointer instead

EDC uses solution #2, but I am not clear if it is a useful thing to do.
See bug 306555 comment #24
Comment 1 Abeer Bagul CLA 2011-10-21 00:51:52 EDT
CDI first checks whether the selected variable is a pointer type, and disables the action "display as array" on non-pointer types.

Can we do the same in DSF? The base interface for a variable in both CDI and DSF is the same, i.e. ICastToArray. In DSF, the method canCastToArray() should return true only if gdb reports that this variable is a pointer type.

Have attached a patch to the DsfCastToTypeSupport which provides this functionality. Due to this patch, the action "display as array" is now visible only on pointer type variables (as reported by gdb).
Comment 2 Abeer Bagul CLA 2011-10-21 00:52:57 EDT
Created attachment 205681 [details]
"Display as array" should be visible only for pointer type variables