Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Re: How to create a custom view to the debug view

Hi Dmitriy Kovalev,

Thanks again. Now I can get value when script suspend. It is a big progress for me. Thank you very much for your kind help.

 

Now I still want to know if there are any rules about the snippet to be evaluated.

If the snippet is $i, and i has been set in the users' script, IScriptValue value = result.getValue();  the value is null. But if snippet is "expr {$i + $j}” as you said, the value can be obtained correctly.

How does IScriptEvaluationEngine evaluate snippet? For example the snippet is turned into "puts $i"? And can this snippet be a segment of Tcl script, including procedure? And if it does support evaluating blocks of script, what will be returned?

If this works, I can write a segment Tcl code to get all the business objects, and pass this segment of code to the method asyncEvaluate.

 

Best regards,

Joy

----- Original Message ----
From: "dltk-dev-request@xxxxxxxxxxx" <dltk-dev-request@xxxxxxxxxxx>
To: dltk-dev@xxxxxxxxxxx
Sent: Saturday, August 4, 2007 6:06:11 AM
Subject: dltk-dev Digest, Vol 6, Issue 5

Send dltk-dev mailing list submissions to
    dltk-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
    https://dev.eclipse.org/mailman/listinfo/dltk-dev
or, via email, send a message with subject or body 'help' to
    dltk-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
    dltk-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dltk-dev digest..."


Today's Topics:

   1. Re: How to create a custom view to the debug view? (wang dada)
   2. Re: How to create a custom view to the debug view?
      (Dmitriy Kovalev)
   3. Support for TODO:  (Robert Ehteshamzadeh (CodeGear))


----------------------------------------------------------------------

Message: 1
Date: Fri, 3 Aug 2007 03:12:14 -0700 (PDT)
From: wang dada <runtoac@xxxxxxxxx>
Subject: Re: [Dltk-dev] How to create a custom view to the debug view?
To: dltk-dev@xxxxxxxxxxx
Message-ID: <969843.16890.qm@xxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="us-ascii"

Hi,
I am trying to use IScriptEvaluationEngine to get code evaluated.
The following is my code, and I put my question in it:

public class ScriptExplorerTreeView extends AbstractDebugView
implements ISelectionListener, IDebugEventSetListener, IScriptEvaluationListener{
    ...
   public void handleDebugEvents(DebugEvent[] events) {
  for (int i = 0; i < events.length; i++) {
   DebugEvent event = events[i];
   switch (event.getKind()) {
   case DebugEvent.BREAKPOINT:    
    if (event.getSource() instanceof IScriptThread) { //Is this event send by the thread in which users' script executing? How can I determine that?
    IScriptThread source = (IScriptThread) event.getSource();
    try {
    //Could you please give me an example of how to evoke asyncEvaluate?
    //asyncEvaluate(String snippet, IScriptStackFrame frame, IScriptEvaluationListener listener)  ;
    //What is snippet look like? And what result will be returned? How can I get the right frame?
          source.getEvaluationEngine().asyncEvaluate("$i",null, (IScriptEvaluationListener)this);      
    
    } catch (Exception e) {
      e.printStackTrace();
     }
    }
    break;
   }
  }  
}
public void evaluationComplete(IScriptEvaluationResult result) {
  try {
   IScriptValue value = result.getValue();
  //The value is null. Why?
   if (value!=null) {
    System.out.println("The result is: "+value.getValueString());    
   } else {
    System.out.println("The result is null");
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
}
    ...
}
Is there any thing wrong with this code? Thanks for your time.

Best regards,
Joy




Message: 1
Date: Thu, 02 Aug 2007 12:10:33 +0700
From: Dmitriy Kovalev <kds@xxxxxxxxx>
Subject: Re: [Dltk-dev] How to create a custom view to the debug view?
To: DLTK Developer Discussions <dltk-dev@xxxxxxxxxxx>
Message-ID: <46B16749.2040901@xxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

This link http://www.eclipse.org/eclipse/debug/documents.php is a good
source of Eclipse debugger documentation. Presentations of two last
EclipseConfs (with source examples) are very useful and explain
practically all parts of Eclipse debug infrastructure with many details.

Eclipse has a common model of debug objects (threads, stack frames and
etc.). Our debug model extends Eclipse model and implements many script
language specific things using DBGP protocol. The main interfaces are:
IScriptThread, IScriptStackFrame, IScriptVariable, IScriptValue. See the
source code for more information.

I think your problem can be solved in the following way. The first thing
you should investigate is the IDebugEventSetListener. Your class may
implement this interface to listen debug events (class DebugEvent).
These events give a complete information about debugging process: when
debugger
suspends, why it suspends (end of step or breakpoint) and etc.
DebugEvent has a good javadoc, read it first. So, you can  detect the
moment when your view should be shown.

Adding information about objects is more complex but realizable task. I
think you should use IScriptEvaluationEngine. This interface allow you
to execute any code (in this case Tcl code) in the application thread
and obtain results as instance of IScriptValue. Evaluation engine
interface can be requested through IScriptThread (method
getEvaluationEgine). Instance of IScriptThread  can be simply extracted
from DebugEvent.

This is a short outline of possible solution. Please, ask additional
questions for more information.

--
Dmitriy Kovalev

wang dada wrote:
> Hi,
> Recently I've been studying the debugger of Dltk. What I want to do is
> adding a custom view to the DebugView, let's say it to be
> CustomObjectView.
> When users' scripte suspend at the breakpoint, CustomObjectView will
> show all the objects created by now. These objects has no
> relation with Tcl lanuage, they are just the bussiness objects created
> by users.
> For example, users script will be like this:  set i [test::newobject1]
>                                                                           set
> j [test::new object2]
>                                                                    
>       test::new relationship -parent  i j
> And I can get all the objects by using:  test::get all to get all
> the created objects and their relations, and show them in
> CustomObjectView with a treeViewer. When user click step,
> CustomObjectView will refresh.
>  
> Could anyone give me some clue or example code to realize it? I've
> read articles at http://www.eclipse.org/eclipse/debug/documents.php,
> but still do not know how to begin. Is there any documents about how
> to realizing debugger of DLTK? Any advise and help will be greatly
> appreciated.
>  
> Best regards,
> Joy
>  
>
> ------------------------------------------------------------------------
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
> <http://us.rd.yahoo.com/evt=48253/*http://mobile.yahoo.com/go?refer=1GNXIC>
> mail, news, photos & more.
> --
> This message was scanned by ESVA and is believed to be clean.
> Click here to report this message as spam.
> <http://mail-gw-us.xored.com/cgi-bin/learn-msg.cgi?id=8A66B299B1.03B83>
> ------------------------------------------------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>  




------------------------------

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


End of dltk-dev Digest, Vol 6, Issue 3
**************************************


      
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/listinfo/dltk-dev/attachments/20070803/afcb5e43/attachment.html

------------------------------

Message: 2
Date: Fri, 03 Aug 2007 17:30:55 +0700
From: Dmitriy Kovalev <kds@xxxxxxxxx>
Subject: Re: [Dltk-dev] How to create a custom view to the debug view?
To: DLTK Developer Discussions <dltk-dev@xxxxxxxxxxx>
Message-ID: <46B303DF.5090005@xxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

wang dada wrote:

First thing, DebugEvent.BREAKPOINT is a detail of event, real event kind
should be checked on DebugEvent.SUSPEND.
> Hi,
> I am trying to use IScriptEvaluationEngine to get code evaluated.
> The following is my code, and I put my question in it:
>  
> public class ScriptExplorerTreeView extends AbstractDebugView
>  implements ISelectionListener, IDebugEventSetListener,
> IScriptEvaluationListener{
>     ...
>    public void handleDebugEvents(DebugEvent[] events) {
>   for (int i = 0; i < events.length; i++) {
>    DebugEvent event = events[i];
>    switch (event.getKind()) {
>    case DebugEvent.BREAKPOINT:    
>     *if (event.getSource() instanceof IScriptThread) { //Is this event
> send by the thread in which users' script executing? How can I
> determine that?*
This event can be sent by any thread of currently executed program. In
many cases this is only one thread.

>     IScriptThread source = (IScriptThread) event.getSource();
>     try {
>    * //Could you please give me an example of how to evoke asyncEvaluate?*
> *    //asyncEvaluate(String snippet, IScriptStackFrame frame,
> IScriptEvaluationListener listener)  ;*
> *    //What is snippet look like? And what result will be returned?
> How can I get the right frame?*
You should set null as a frame. String snippet is a code to evaluate,
e.g.  "expr {$a + $b}", listener is the object that would be notified
when evaluation
completed, i.e. the method evaluationComplete(IScriptEvaluationResult
result). Result gives the IScriptValue instance.

>           source.getEvaluationEngine().asyncEvaluate("$i",null,
> (IScriptEvaluationListener)this);      
>    
>     } catch (Exception e) {
>       e.printStackTrace();
>      }
>     }
>     break;
>    }
>   }  
>  }
>  public void evaluationComplete(IScriptEvaluationResult result) {
>   try {
>    IScriptValue value = result.getValue();
>   //The value is null. Why?
>    if (value!=null) {
>     System.out.println("The result is: "+value.getValueString());    
>    } else {
>     System.out.println("The result is null");
>    }
>   } catch (Exception e) {
>    e.printStackTrace();
>   }
>  }
>     ...
> }
> Is there any thing wrong with this code? Thanks for your time.
>  
> Best regards,
> Joy
>  
>
>  
>
> Message: 1
> Date: Thu, 02 Aug 2007 12:10:33 +0700
> From: Dmitriy Kovalev <kds@xxxxxxxxx>
> Subject: Re: [Dltk-dev] How to create a custom view to the debug view?
> To: DLTK Developer Discussions <dltk-dev@xxxxxxxxxxx>
> Message-ID: <46B16749.2040901@xxxxxxxxx>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hello,
>
> This link http://www.eclipse.org/eclipse/debug/documents.php is a good
> source of Eclipse debugger documentation. Presentations of two last
> EclipseConfs (with source examples) are very useful and explain
> practically all parts of Eclipse debug infrastructure with many details.
>
> Eclipse has a common model of debug objects (threads, stack frames and
> etc.). Our debug model extends Eclipse model and implements many script
> language specific things using DBGP protocol. The main interfaces are:
> IScriptThread, IScriptStackFrame, IScriptVariable, IScriptValue. See the
> source code for more information.
>
> I think your problem can be solved in the following way. The first thing
> you should investigate is the IDebugEventSetListener. Your class may
> implement this interface to listen debug events (class DebugEvent).
> These events give a complete information about debugging process: when
> debugger
> suspends, why it suspends (end of step or breakpoint) and etc.
> DebugEvent has a good javadoc, read it first. So, you can  detect the
> moment when your view should be shown.
>
> Adding information about objects is more complex but realizable task. I
> think you should use IScriptEvaluationEngine. This interface allow you
> to execute any code (in this case Tcl code) in the application thread
> and obtain results as instance of IScriptValue. Evaluation engine
> interface can be requested through IScriptThread (method
> getEvaluationEgine). Instance of IScriptThread  can be simply extracted
> from DebugEvent.
>
> This is a short outline of possible solution. Please, ask additional
> questions for more information.
>
> --
> Dmitriy Kovalev
>
> wang dada wrote:
> > Hi,
> > Recently I've been studying the debugger of Dltk. What I want to do is
> > adding a custom view to the DebugView, let's say it to be
> > CustomObjectView.
> > When users' scripte suspend at the breakpoint, CustomObjectView will
> > show all the objects created by now. These objects has no
> > relation with Tcl lanuage, they are just the bussiness objects created
> > by users.
> > For example, users script will be like this:  set i [test::newobject1]
> >                                                                          
> set
> > j [test::new object2]
> >                                                                    
> >       test::new relationship -parent  i j
> > And I can get all the objects by using:  test::get all to get all
> > the created objects and their relations, and show them in
> > CustomObjectView with a treeViewer. When user click step,
> > CustomObjectView will refresh.
> >  
> > Could anyone give me some clue or example code to realize it? I've
> > read articles at http://www.eclipse.org/eclipse/debug/documents.php,
> > but still do not know how to begin. Is there any documents about how
> > to realizing debugger of DLTK? Any advise and help will be greatly
> > appreciated.
> >  
> > Best regards,
> > Joy
> >  
> >
> > ------------------------------------------------------------------------
> > Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
> >
> <http://us.rd.yahoo.com/evt=48253/*http://mobile.yahoo.com/go?refer=1GNXIC>
>
> > mail, news, photos & more.
> > --
> > This message was scanned by ESVA and is believed to be clean.
> > Click here to report this message as spam.
> > <http://mail-gw-us.xored.com/cgi-bin/learn-msg.cgi?id=8A66B299B1.03B83>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > dltk-dev mailing list
> > dltk-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/dltk-dev
> >  
>
>
>
>
> ------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
>
> End of dltk-dev Digest, Vol 6, Issue 3
> **************************************
>
>
> ------------------------------------------------------------------------
> Be a better Globetrotter. Get better travel answers
> <http://us.rd.yahoo.com/evt=48254/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545469>from
> someone who knows.
> Yahoo! Answers - Check it out.
> --
> This message was scanned by ESVA and is believed to be clean.
> Click here to report this message as spam.
> <http://mail-gw-us.xored.com/cgi-bin/learn-msg.cgi?id=8868A299B7.425AF>
> ------------------------------------------------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>  




------------------------------

Message: 3
Date: Fri, 03 Aug 2007 15:08:00 -0700
From: "Robert Ehteshamzadeh (CodeGear)" <rehteshamzadeh@xxxxxxxxxxxx>
Subject: [Dltk-dev] Support for TODO:
To: DLTK Developer Discussions <dltk-dev@xxxxxxxxxxx>
Message-ID: <46B3A740.7070006@xxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Tasks view does not Pick up #TODO: from source files.

test case:

MENU: File | New | Ruby Source File
Type # TODO: A task
MENU: File | Save
MENU: Window | Show View | Tasks

Expected:
  TODO is picked up in Tasks
Actual:
  Not yet

Is this a bug, or simply has not yet been implemented?

--
Robert Ehteshamzadeh
QA Engineer,  CodeGear
rehteshamzadeh@xxxxxxxxxxxx
831-431-1226



------------------------------

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


End of dltk-dev Digest, Vol 6, Issue 5
**************************************



Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.

Back to the top