Bug 306553 - [var] Extend expressions service to allow casting to type and showing arrays
Summary: [var] Extend expressions service to allow casting to type and showing arrays
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 7.0   Edit
Assignee: Ed Swartz CLA
QA Contact: Pawel Piech CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 219203
  Show dependency tree
 
Reported: 2010-03-19 13:09 EDT by Ed Swartz CLA
Modified: 2010-05-28 12:05 EDT (History)
5 users (show)

See Also:
pawel.1.piech: review? (Randy.Rohrbach)


Attachments
patch against HEAD (27.03 KB, patch)
2010-03-19 13:09 EDT, Ed Swartz CLA
no flags Details | Diff
updated patch with CDT changes to move support into command framework (81.66 KB, patch)
2010-03-22 14:20 EDT, Ed Swartz CLA
pawel.1.piech: iplog-
Details | Diff
fixes for assertion errors (7.50 KB, patch)
2010-03-29 09:30 EDT, Ed Swartz CLA
pawel.1.piech: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Swartz CLA 2010-03-19 13:09:39 EDT
Created attachment 162544 [details]
patch against HEAD

This is the API for an IExpressions2, an extension of IExpressions that lets a backend support cast to type and displaying arrays as directed by the CDT UI core (ICastToType, ICastToArray).

See discussion in #219203 for the design discussion.  

This has been tested successfully with EDC, so it works great in practice.  We just want to see if the gdb side can work with the concept of an ICastedExpressionDMContext interface that extends IExpressionDMContext.
Comment 1 Pawel Piech CLA 2010-03-19 14:56:57 EDT
Thanks for splitting out the bugs.  This bug is an API change so we have a process issue to consider: 
1) need to email cdt-dev upon making this change.
2) in the past releases in DSF we required a review (from another committer) before committing the change.  This is not a formal CDT process but it would be a good idea.

I think the patch looks good except one issue that I've come across when testing it.  The cast to type actions are enabled and visible whether the underlying service supports them or not.  I don't think this is acceptable, because it's really a regression for debuggers that won't implement IExpressions2.  We can solve this by making ICastToType and ICastToArray accessible through getAdapter() and converting the cast actions to commands (in the same way that I convnerted the breakpoint properties action in bug 303553).
Comment 2 Ed Swartz CLA 2010-03-22 10:23:30 EDT
(In reply to comment #1)
> I think the patch looks good except one issue that I've come across when
> testing it.  The cast to type actions are enabled and visible whether the
> underlying service supports them or not.  

Oh yes, I had completely forgotten that.

I'll convert it to the command framework like you mentioned.  Then we can alert cdt-dev...
Comment 3 Ed Swartz CLA 2010-03-22 14:20:13 EDT
Created attachment 162705 [details]
updated patch with CDT changes to move support into command framework

Ok, this patch changes the cast to type/array and view as array commands into the new-style commands and fetches the ICastToType/Array through adapters.  Tested with cdi/gdb (works), dsf/gdb (does not show up, as expected), and EDC.

Along the way, since I thought I had to hook up the adapter in a different way, I moved all the DSF casting support out into a standalone class (DsfCastToTypeSupport).  Turns out that wasn't necessary.  But anyway, it's done, and looks cleaner.  

VariableVMProvider and ExpressionVMProvider will attach the DsfCastToTypeSupport at construction time to the VariableVMNode based on finding IExpressions2 support.
Comment 4 Ed Swartz CLA 2010-03-23 11:33:33 EDT
(In reply to comment #1)
> Thanks for splitting out the bugs.  This bug is an API change so we have a
> process issue to consider: 
> 1) need to email cdt-dev upon making this change.

Do I ask permission first, or just announce it after the fact?  

> 2) in the past releases in DSF we required a review (from another committer)
> before committing the change.  This is not a formal CDT process but it would be
> a good idea.

Randy, could you review the DSF change?
Comment 5 Pawel Piech CLA 2010-03-24 15:05:19 EDT
(In reply to comment #4)
> Do I ask permission first, or just announce it after the fact? 
I think announce after the fact is enough.

> > 2) in the past releases in DSF we required a review (from another committer)
> > before committing the change.  This is not a formal CDT process but it would be
> > a good idea.
> 
> Randy, could you review the DSF change?
I'm sorry I wasn't very clear.  One person's review is enough, at least until we get to the release candidates stage.  But of course you're welcome to invite anyone else to review as well.
Comment 6 Ed Swartz CLA 2010-03-24 16:33:33 EDT
Committed patch (with minor revisions).
Comment 7 Ed Swartz CLA 2010-03-29 09:30:12 EDT
Created attachment 163262 [details]
fixes for assertion errors

Argh, I wasn't running my workbench with "-ea", and there were problems with not properly using the executor thread in actual usage.  This addresses them.
Comment 8 Ed Swartz CLA 2010-03-29 09:44:09 EDT
Applied patch.
Comment 9 John Cortell CLA 2010-03-29 10:38:16 EDT
(In reply to comment #7)
> Argh, I wasn't running my workbench with "-ea", and there were problems with
> not properly using the executor thread in actual usage.  

I've always thought a new runtime-workbench launch config type should have that VM switch by default.
Comment 10 Marc Khouzam CLA 2010-05-04 14:37:35 EDT
I notice that the javadoc for IExpressions2#createCastedExpression is a bit off.  It mentions an rm param which does not exist.

* @param rm request monitor returning a casted expression data model context object that must be passed to the appropriate
*          data retrieval routine to obtain the value of the expression.  The object must
*          report the casted type (if any) via {@link #getExpressionData(IExpressionDMContext, DataRequestMonitor)}
*          and report alternate children according to the array casting context via 
*          {@link #getSubExpressionCount(IExpressionDMContext, DataRequestMonitor)}
     *          and {@link #getSubExpressions}.

However, some information in that text seems valuable and should probably be kept.

Ed, maybe you can shed some light on what the proper javadoc should say?

Thanks
Comment 11 Ed Swartz CLA 2010-05-04 16:09:46 EDT
(In reply to comment #10)
> I notice that the javadoc for IExpressions2#createCastedExpression is a bit
> off.  It mentions an rm param which does not exist.
> 
> However, some information in that text seems valuable and should probably be
> kept.
> 
> Ed, maybe you can shed some light on what the proper javadoc should say?

Oops, the "@param rm a request monitor which" became "@return".  Everything else still applies.  I updated the file in CVS.  Thanks!
Comment 12 Pawel Piech CLA 2010-05-28 12:05:07 EDT
Randy, please review sometime.