Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311210 - [commands][cdi] Missing support for "target-download"
Summary: [commands][cdi] Missing support for "target-download"
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 7.0   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
: 237021 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-30 12:36 EDT by Nobody - feel free to take it CLA
Modified: 2011-05-17 10:21 EDT (History)
3 users (show)

See Also:
nobody: iplog-


Attachments
Patch that adds new MITargetDownload command and modifies CommandFactory. (10.16 KB, patch)
2010-04-30 12:36 EDT, Nobody - feel free to take it CLA
no flags Details | Diff
Updated patch. (10.53 KB, patch)
2010-05-02 18:34 EDT, Nobody - feel free to take it CLA
nobody: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2010-04-30 12:36:07 EDT
Created attachment 166638 [details]
Patch that adds new MITargetDownload command and modifies CommandFactory.

"target-download" is not supported by DSF/GDB. 
Attached is a patch that adds a new command (MITargetDownload) and modifies CommandFactory. Note: I didn't add the "since" annotations because the versioning of DSF is different.
Comment 1 Marc Khouzam CLA 2010-04-30 13:03:33 EDT
(In reply to comment #0)
> Created an attachment (id=166638) [details]
> Patch that adds new MITargetDownload command and modifies CommandFactory.
> 
> "target-download" is not supported by DSF/GDB. 
> Attached is a patch that adds a new command (MITargetDownload) and modifies
> CommandFactory. Note: I didn't add the "since" annotations because the
> versioning of DSF is different.

Nice.  Just some questions.

1- I think you can put the @since 3.0 on MITargetDownload
2- I guess you are not interested in the result of the MITargetDownload? Apparently GDB will return something like 
^done,address="0x10004",load-size="9880",transfer-rate="6586",write-rate="429"
which does not seem overly interesting to me either...
3- The new API of command factory requires a ICommandControlDMContext while MITargetDownload requires only an IDMContext.  What that on purpose?
4- I'm guessing that your setting of Pref->Java->CodeSyte->OrganizeImports has "Number of imports needed for .*" set to something lower than mine.  Is there some agreement for CDT?  I'm asking because after you commit this change to CommandFactory, if I have to change that class, my eclipse will automatically change all the imports back.  My setting was the default of 99 (I think its the default because I never knew about this preference before :-)).
Comment 2 Nobody - feel free to take it CLA 2010-04-30 13:16:53 EDT
(In reply to comment #1)
> Nice.  Just some questions.
> 1- I think you can put the @since 3.0 on MITargetDownload

Will do assuming it is not too late.
 
> 2- I guess you are not interested in the result of the MITargetDownload?
> Apparently GDB will return something like 
> ^done,address="0x10004",load-size="9880",transfer-rate="6586",write-rate="429"
> which does not seem overly interesting to me either...

I can modify the patch and a new MIInfo, if it's not too late for API changes.
In fact this command is a special command: it reports progress. I think we can take advantage of it in the future and display it in the launch configuration progess bar. But it requires a new MICommand type.

> 3- The new API of command factory requires a ICommandControlDMContext while
> MITargetDownload requires only an IDMContext.  What that on purpose?
> 4- I'm guessing that your setting of Pref->Java->CodeSyte->OrganizeImports has
> "Number of imports needed for .*" set to something lower than mine.  Is there
> some agreement for CDT?  I'm asking because after you commit this change to
> CommandFactory, if I have to change that class, my eclipse will automatically
> change all the imports back.  My setting was the default of 99 (I think its the
> default because I never knew about this preference before :-)).

Thanks for pointing me to this preference - I wasn't aware of it and don't .* for imports. What is your number now? Mine is default - 99. Is it possible to set it to infinite? :)
Comment 3 Marc Khouzam CLA 2010-04-30 13:41:53 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Nice.  Just some questions.
> > 1- I think you can put the @since 3.0 on MITargetDownload
> 
> Will do assuming it is not too late.

Oh you mean for API freeze?  I guess you're supposed to ask the list.  From my point-of-view, you are only adding something new, so I'm ok with it.

> > 2- I guess you are not interested in the result of the MITargetDownload?
> > Apparently GDB will return something like 
> > ^done,address="0x10004",load-size="9880",transfer-rate="6586",write-rate="429"
> > which does not seem overly interesting to me either...
> 
> I can modify the patch and a new MIInfo, if it's not too late for API changes.
> In fact this command is a special command: it reports progress. I think we can
> take advantage of it in the future and display it in the launch configuration
> progess bar. But it requires a new MICommand type.

That sounds nice, but complicated :-)
I guess it is not necessary for this patch.

> > 3- The new API of command factory requires a ICommandControlDMContext while
> > MITargetDownload requires only an IDMContext.  What that on purpose?
> > 4- I'm guessing that your setting of Pref->Java->CodeSyte->OrganizeImports has
> > "Number of imports needed for .*" set to something lower than mine.  Is there
> > some agreement for CDT?  I'm asking because after you commit this change to
> > CommandFactory, if I have to change that class, my eclipse will automatically
> > change all the imports back.  My setting was the default of 99 (I think its the
> > default because I never knew about this preference before :-)).
> 
> Thanks for pointing me to this preference - I wasn't aware of it and don't .*
> for imports. What is your number now? Mine is default - 99. Is it possible to
> set it to infinite? :)

My number is 99 as well.  If yours is too then when doing Ctrl-sht-o in CommandFactory it should remove the .* in the import.
Comment 4 Marc Khouzam CLA 2010-04-30 13:43:23 EDT
(In reply to comment #2)

Oh yeah, what about:

> > 3- The new API of command factory requires a ICommandControlDMContext while
> > MITargetDownload requires only an IDMContext.  Was that on purpose?
Comment 5 Nobody - feel free to take it CLA 2010-04-30 14:08:23 EDT
(In reply to comment #4)
> (In reply to comment #2)
> Oh yeah, what about:
> > > 3- The new API of command factory requires a ICommandControlDMContext while
> > > MITargetDownload requires only an IDMContext.  Was that on purpose?

Sorry for being sloppy. I have been trying to get the patch in time and simply copied and pasted pieces from different commands. But I am looking now at say MITargetAttach and trying to understand what difference it makes. getCommandControlId of ICommandControlDMContext doesn't seem to get called anywhere. Can you please clarify?
Comment 6 Marc Khouzam CLA 2010-04-30 14:27:18 EDT
(In reply to comment #5)
> > > > 3- The new API of command factory requires a ICommandControlDMContext while
> > > > MITargetDownload requires only an IDMContext.  Was that on purpose?
> 
> Sorry for being sloppy. I have been trying to get the patch in time and simply
> copied and pasted pieces from different commands. But I am looking now at say
> MITargetAttach and trying to understand what difference it makes.
> getCommandControlId of ICommandControlDMContext doesn't seem to get called
> anywhere. Can you please clarify?

No actual difference.  I personally like choosing the most specific context the code will expect, just as a way to document the API better.  When I see a command that wants an IDMContext, it is always difficult to understand which one I should use.  If the API requires an IBreakpointDMContext, for example, then it makes it easier on the caller to know what to do.

For target-download, I assume we only need to know the ICommandControlDMC (i.e., which gdb), and nothing about a thread, process or anything like that.  So ICommandControlDMC seems good.

If you had a case where you wanted to accept different things you could use an IDMContext, or you could have multiple constructors (MIDataEvaluateExpression is an example of the latter).
Comment 7 Nobody - feel free to take it CLA 2010-04-30 14:40:05 EDT
(In reply to comment #6)
Thanks, I'll update the patch.
Comment 8 Nobody - feel free to take it CLA 2010-05-02 18:34:36 EDT
Created attachment 166741 [details]
Updated patch.
Comment 9 Nobody - feel free to take it CLA 2010-05-02 18:38:07 EDT
Changed the argument type of the constructor to ICommandControlDMContext. Added new MITargetDownloadInfo class to process the result. Corrected the since tags.
Comment 10 Marc Khouzam CLA 2010-05-03 09:29:06 EDT
(In reply to comment #8)
> Created an attachment (id=166741) [details]
> Updated patch.

Nice.

I noticed that GDB accepts another parameter to this command: "offset".  Just in case you are interested in supporting it.  Neither "offset" nor "file" are documented in the GDB manual.

(gdb) interpreter-exec mi "-target-download j j"
^error,msg="Invalid download offset:j."

(gdb) interpreter-exec mi "-target-download j 2"
^error,msg="j: No such file or directory."
Comment 11 Nobody - feel free to take it CLA 2010-05-03 10:08:24 EDT
(In reply to comment #10)
> (In reply to comment #8)
> > Created an attachment (id=166741) [details] [details]
> > Updated patch.
> Nice.
> I noticed that GDB accepts another parameter to this command: "offset".  Just
> in case you are interested in supporting it.  Neither "offset" nor "file" are
> documented in the GDB manual.
> (gdb) interpreter-exec mi "-target-download j j"
> ^error,msg="Invalid download offset:j."
> (gdb) interpreter-exec mi "-target-download j 2"
> ^error,msg="j: No such file or directory."

Don't know, in theory it should have "offset" and probably some others. cc-ing Dan, maybe he can help.
Can we go ahead with this? I am worried of missing this milestone.
Comment 12 Marc Khouzam CLA 2010-05-03 10:54:50 EDT
(In reply to comment #11)
> Can we go ahead with this? I am worried of missing this milestone.

Yes of course.
I'm assuming you are doing those commits.
Comment 13 Nobody - feel free to take it CLA 2010-05-03 11:20:57 EDT
Committed to the HEAD.
Comment 15 Marc Khouzam CLA 2011-05-17 10:21:05 EDT
*** Bug 237021 has been marked as a duplicate of this bug. ***