Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Cast to type support (was: Note: API addition in DSF)

Hi Axel,

If you're unfamiliar with the internals, probably it'd be good to know the similarities and differences between the EDC and GDB/MI debuggers.

Any DSF debugger handles expressions mainly in terms of textual input expressions via IExpressions#creatExpression() and then returns textual results as the formatted value of those expressions, via IFormattedValues#getFormattedExpressionValue().

When comparing EDC and GDB/MI, note that EDC tries to do almost all the work itself -- when evaluating expressions, it only asks the backend for memory and register values.  Otherwise, it uses CDT to make an AST and then evaluates the tree itself.  For GDB/MI, though, I think the whole expression text is sent over the wire and the answer is retrieved from GDB.  So, be aware of those differences when figuring out what's involved in casting.

Thus, to support IExpressions2, I think you need to look mainly into:

-- how to advertise casting support (hint: mention IExpressions2.class.getName() using AbstractDsfService#register)

-- how ICastedExpressionDMContext relates to IExpressionDMContext 

-- how to modify the expressions requested of GDB when a type cast is present via ICastedExpressionDMContext (EDC does this too, in CastedExpressionDMC), and how to modify the type you return via IExpressionDMData

-- how to modify subexpressions requested of GDB when an array view is present via ICastedExpressionDMContext (e.g. in IExpressions#getSubExpressionCount and IExpressions#getSubExpressions)

Note that both type casts and array views can be in play at the same time.

Good luck :)

-- Ed

-----Original Message-----
From: Axel Müller [mailto:aegges@xxxxxx] 
Sent: Thursday, April 22, 2010 4:19 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] Note: API addition in DSF

Seems like I have to implement something similar to Expressions.java in EDC (which is rather longish! Do I need all of this?).

e.g.
public class MICastToArray extends AbstractDsfService implements IExpressions2 in org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service

But how (and where) do I register the service? Or should I extend MIExpressions?

A lot of questions...

Perhaps these questions seems to be silly but I am still a freshman with respect to to the Eclipse interns (and terminology).

  Axel

> I don't know the details or the complexity of this bug, but if Axel is 
> willing to give it a try, I will gladly review and answer  questions.
> 
> I believe EDC is using this interface, so it may serve as a good example.
> 
> Please let us know if I'm being overly optimistic about the issue.
> 
> It could be the Axel's first step in a long and pleasant journey with 
> the  CDT code. :-)
> 
> 
> ________________________________
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] 
> On  Behalf Of Pawel Piech Sent: April-19-10 4:03 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] Note: API addition in DSF
> 
> Well 7.0 is not here yet.  So hold your breath...
> 
> Cheers,
> Pawel
> 
> Axel Müller wrote:
> 
> That's a pity. That feature is very important for me and might 
> therefore be  a show stopper to use DSF.
> Would it be difficult to implement for somebody who has no knowledge 
> of DSF and only little about Eclipse?
> 
>    Axel
> 
> 
> I think either me or Randy were signed up to work on this, but we've 
> had a lot of non Eclipse work come up lately and haven't been able to 
> make any progress on this.  If anyone has time to complete this 
> implementation please go ahead.
> -Pawel
> 
> Axel Müller wrote:
> 
> 
> Anybody working on the gdb implementation for DSF?
> 
>    Axel
> 
> 
> 
> Hi,
> 
> As part of Bug
> 306553<https://bugs.eclipse.org/bugs/show_bug.cgi?id=306553><https://b
> ugs.e clipse.org/bugs/show_bug.cgi?id=306553> - Extend expressions 
> service to  allow casting to type and showing arrays , I added a new 
> DSF service  "IExpressions2" so a backend can support this 
> implementation.  No other  APIs were modified.
> 
> The CDT UI commands for this (Cast To Type/Display As Array/Restore  
> Original Type) were converted to new-style Eclipse commands in the  
> process, so an adapter can implement ICastToType/ICastToArray.  I  
> validated that this still works with CDI/GDB.
> 
> -- Ed
> 
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx<mailto:cdt-dev@xxxxxxxxxxx>
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 
> 
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx<mailto:cdt-dev@xxxxxxxxxxx>
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 




Back to the top