Skip to main content

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

Hello Joy,
Here is the situation, we want to debug users' script which is written in Tcl, and we realize our debugger in Java, right?
This is not correct exactly. DLTK debugging framework is based on the DBGP protocol ( This protocol implies that we have so called "debugging engine" and IDE. Debugging engine is a real debugger that can debug, for example, tcl script (or another scripting language). Debugging engine communicates with IDE using a DBGP protocol. It means that when you setup breakpoint in Eclipse the command to debugging engine is generated. For Tcl language we currently using debugging engine from ActiveState, for ruby we created own debugging engine.

When I refresh CustomObjectView, I got the business objects and relations through the java API of our business logic.
It is like this:
sObjects = sJava.sGet(root, new StringVector());
and then I can construct the object tree recursively.
Dltk run users' Tcl script by creating a new thread to run the tcl interpreter, right? The above code getting bussiness objects runs in the main thread. I am wondering, *if the main thread can get the objects created in the thread that interpreter running?*
There is no any connection between java threads in Eclipse and threads in tcl interpreter. Tcl interpreter is an independently started program. If we want two know what objects (local or global variables, for example) available in current stack frame we simply send a DBGP command to debugging engine and parse its response to fill appropriate variables view.

** After I read your mail, especially the IScriptEvaluationEngine part, I think there might be another solution do not need the java API to get objects. As you said I can execute tcl code, say test::get all, and return it as IScriptValue. And then use this instance of IScriptValue to construct the object tree, right? Does this support structed data? And is this solution feasible?
Yes, it's possible. Simply speaking, IScriptEvaluationEngine allows you to execute tcl 'eval' command at the current stack frame and obtain results as IScriptValue. IScriptValue allows you to request its children using getVariables method (Eclipse debugging framework has a separation of Variables and its Values). Then request a IScriptValue from a IScriptVariable and etc. So, the object tree can be constructed. Then you can investigate these objects and transform to your own structures and do anything with them :)

Please give some comments on these two solutions. Thanks again.
Best regards,
----- Original Message ----
From: "dltk-dev-request@xxxxxxxxxxx" <dltk-dev-request@xxxxxxxxxxx>
To: dltk-dev@xxxxxxxxxxx
Sent: Friday, August 3, 2007 12:00:23 AM
Subject: dltk-dev Digest, Vol 6, Issue 3

Send dltk-dev mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

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?
      (Dmitriy Kovalev)


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


This link 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
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,
> 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:
> <*>
> mail, news, photos & more.
> --
> This message was scanned by ESVA and is believed to be clean.
> Click here to report this message as spam.
> <>
> ------------------------------------------------------------------------
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx


dltk-dev mailing list

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

Luggage? GPS? Comic books?
Check out fitting gifts for grads <*> at Yahoo! Search.
This message was scanned by ESVA and is believed to be clean.
Click here to report this message as spam. <>

dltk-dev mailing list

Back to the top