RE: SmartFrog Debugger
"Guijarro, Julio" <[email protected]>
| Newsgroups | gmane.comp.java.smartfrog.devel |
|---|---|
| Message-ID | <8D5B24B83C6A2E4B9E7EE5FA82627DC994A70A@sdcexcea01.emea.cpqcorp.net> |
Vedavyas,
There is already a bit of debugging support in the Trace/TraceDisplay
components.
Trace can register for all or some subset of lifecycle hooks
(deploy,start,terminate) and TraceDisplay receives and interprets
messages send by Trace to build a tree representation of the deployment
steps.
---
// TraceDisplay component
// Extension of Display to show a tree of components with info got using
SFTrace
// Same parameters as sfServices.display.
TraceDisplay extends Display {
sfClass "org.smartfrog.services.trace.SFTraceDisplay";
nameDisplay "SF Trace Display (Exit: alt+F4 )"; //Window Title
positionDisplay "SW"; //Default C. (also N, S, SE, ...)
redirectStd false; //Redirect System.out,.in,.err
screenEditable false; //Editable?
stepTrace false; // Should ask for confirmation before stepping
through?
}
--
Also, if the attribute stepTrace is true in TraceDisplay, then it will
display a dialog window asking the user to resume after every message
that it receives. This allows you to have a controlled step by step
deployment.
You get something like the following dialog, where:
- Yes means -> Continue until next lifecycle hook (message)
- No means -> Don't ask ever again.
This mechanism is very basic as it is all or nothing and TraceDisplay
does not allow you to define any filters/break points to only ask when
certain lifecycle in a certain component happens but this would be very
easy to add because the message has all the information needed and we
could use regular expressions to do the matching.
This can be done modifying the method printMsg in
services/SFDisplayTrace.java:
/**
* Prints the message.
*
* @param msg message
*/
public void printMsg(String msg) {
super.printMsg(msg);
// We print in the output
((TraceTreePanel) panelTree).add(msg);
if (stepTrace == 0) getUserConfirmation(this.display, msg);
}
The other shortcoming is that TraceDisplay is a graphical component and
it needs to be deployed in a machine with a graphical display. A
non-graphical version of it would be trivial.
To see how it works you only need to modify your dis/bin/default.sf in
the following way:
- Uncomment
outputMsg LAZY ATTRIB displayTrace; in DefaultTraceCompound
- Commnet
outputMsg LAZY HOST localhost:rootProcess:sfDefault:display; in
DefaultTraceCompound.
- Uncomment last line in default.sf
sfConfig extends DefaultTraceCompound;
Then start the daemon and deploy any example.
Default.sf
....
DefaultTraceCompound extends DefaultCompound {
displayTrace extends DisplayTrace;
trace extends Trace{ // Component lifecycle trace notification
outputMsg LAZY ATTRIB displayTrace;
outputMsg LAZY HOST localhost:rootProcess:sfDefault:display;
}
// log extends DefaultLog; // Logs standard output and error to a
file
}
DefaultPersistantCompound extends DefaultCompound {
persister extends SFPersist {
directory "/tmp/sfPersist/";
}
}
sfConfig extends DefaultCompound;
// Alternative default compound with persitance pattern enabled
// Uncoment next line to use it.
//sfConfig extends DefaultPersistantCompound;
// Alternative default compound with tracing or/and log to file enabled.
// Uncoment next line to use it.
//sfConfig extends DefaultTraceCompound;
Also you could use the extension mechanism in the language: "Functions"
to add some extra debugging to the language. But I don't think this is
what you were asking for.
Regards,
Julio Guijarro
> -----Original Message-----
> From: smartfrog-developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:smartfrog-
> developer-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Goldsack, Patrick
> Sent: 17 March 2005 07:26
> To: vedavyas raichur; smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Subject: Re: [Smartfrog-developer] SmartFrog Debugger
>
> Vedavyas,
>
> One simple idea is to place the "break-point" component as a hook for
the
> specific lifecycle methods - to understand how to do this have a look
at
> the
> Trace component. The hook is imvoked by the "super" call in the
lifecycle.
> It can then request the name of the component which the hook is given
and
> decide whether to stop or continue.
>
> Another might be to modify the PrimImpl class, and create a
> DebuggingPrimImpl and associated template, but this would be less
"add-
> on".
>
> If you need enhancements to make it work well, let us know and we can
> discuss how best to do this.
>
> If you are successful, we would be very interested in adding this to
the
> codebase.
>
> Patrick
>
> ----- Original Message -----
> From: "vedavyas raichur" <[email protected]>
> To: <smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> Sent: Thursday, March 17, 2005 6:59 AM
> Subject: [Smartfrog-developer] SmartFrog Debugger
>
>
> > Hi,
> > I am trying to write a distributed debugger for SmartFrog. I am
> > trying to design an API which returns a vector of breakpoints for a
> > given description.
> > As Smartfrog creates a treee and deploys the tree on specified
hosts,
> > we need to stop the deployment at some logical location.
> >
> > can anyone tell me an idea of how to implement it.
> >
> > regards,
> > Vedavyas
> >
> >
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real
users.
> > Discover which products truly live up to the hype. Start reading
now.
> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > _______________________________________________
> > Smartfrog-developer mailing list
> > Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > https://lists.sourceforge.net/lists/listinfo/smartfrog-developer
> >
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Smartfrog-developer mailing list
> Smartfrog-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/smartfrog-developer
image001.jpg
(image/jpeg, 13.6 KB) - not displayed