Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312519 - [expressions] Display as Array fails for non-pointers
Summary: [expressions] Display as Array fails for non-pointers
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-11 20:30 EDT by Marc Khouzam CLA
Modified: 2020-09-04 15:19 EDT (History)
4 users (show)

See Also:


Attachments
"Display as array" should be visible only for pointer type variables (1.37 KB, patch)
2011-10-21 00:52 EDT, Abeer Bagul 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 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