Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how get debug information from the debug frame

18 views
Skip to first unread message

Jaimon

unread,
Nov 9, 2009, 8:51:39 AM11/9/09
to
hi,

i have followed the very good example of David Parks regarding to how
to implement and embed the rhino debugger.
i have few questions regarding it:

1) once i am the public void onDebuggerStatement(Context cx) function
is being called and i have the context.
how can i retrieve the debug information from the context? how can
i get all the variables list and their values?
2) what is the use of the contextData that the setDebugger is getting
as a parameter? all the examples that i have seen didn't really
use it.

thanks a lot
me

Jaimon

unread,
Nov 9, 2009, 9:41:56 AM11/9/09
to

David Parks

unread,
Nov 10, 2009, 8:07:12 AM11/10/09
to dev-tech-js-...@lists.mozilla.org
I posted an example somewhere?? Whooohoo! :)

You can access the variables via the scope object. You can use the debugger
ContextData object to store a reference to the scope object so that it can
be used in the various onDebug methods. Here's a few copy/paste code
sinppets using scope.get and scope.getIds to scan the variables in the
scope. If it helps I can send you a full method that recursively scans the
entire set of variables presents in a given scope (it's a quazi memory count
function), just send me an email if you want the full 40ish lines of code as
an example.

// Object[] jsObjects = ((DebuggableObject)scope).getAllIds();
//Debug operation
Object[] jsObjects = scope.getIds(); //Normal operation - only
counts variables in the instance scope

for (Object variable : jsObjects) {
Object valueObj = scope.get(variable.toString(), scope);

} else if ((valueObj instanceof Scriptable) &&
!variable.equals("prototype")) {
memCount += checkMemoryRecursive(((Scriptable)
valueObj), 0, duplicateSherrif, ++indent); //Recurse into the
ScriptableObject


ContextData is just a generic object you can use as you see fit. It's used
to keep references to things that you will need once you get into the
onDebug methods.

Dave

hi,

thanks a lot
me
_______________________________________________
dev-tech-js-engine-rhino mailing list
dev-tech-js-...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

0 new messages