Stack Trace Function

xavier.bury at clearstream.com xavier.bury at clearstream.com
Fri Jun 22 09:39:29 EDT 2007


Hi Len,

There's the classical and there the "global" way to debug... Im sure some 
people in the "best practices" thread might not like what i say but it is 
a suggestion and nothing prevents you from using a custom prop either to 
do the same thing. I love globals.

But what i can propose as a solution is this:

There's tracing and there's debug traces...
If you want to debug something for example:

global debugcheck

on myhandlerOrEvenTtriggerOrFunctionName 
  if debugcheck is true then debugcheckpoint

then you will be tracing in debug mode...

The other way is more complicated however. If you want a written trace and 
not a debug trace,
then what you would do is to have a parallel statement to all your 
statements that get or set
some value somewhere to be written to a debug file. For example:

global debugcheck

on myhandlerOrEvenTtriggerOrFunctionName aparam
  if debugcheck["status"] is true then writetotracefile("Executing 
myhandlerOrEvenTtriggerOrFunctionName ","parameter",aparam)
  get something(aparam)
  if debugcheck["status"] is true then writetotracefile("Executing 
myhandlerOrEvenTtriggerOrFunctionName ",get something(aparam), it)

etc...

The second solution is very useful if you need to see what the customer is 
doing without you having to intervene. Just ask the user for the trace 
file and you can see what happens.

the second solution can be triggered via a config file with a debug 
parameter read at teh start of your program or a preferences feature in 
your gui. 

Second solution is not the simplest but damn it rocks when you need it! 
The first solution is my favorite though. I also use a separate stack to 
collect the debugging history which 
can be quite helpful for post-error analysis.

hope that helps
Xavier


use-revolution-bounces at lists.runrev.com wrote on 22/06/2007 15:25:35:

> In trying to debug a rather complex application, I'm wondering if there 
> is some sort of "stack trace" fuction (like there is in Tcl/Tk) so that 
> when a message is sent, I can see the calling sequence that got me 
there?
> 
> What's happening is that I have a message that clears a group when the 
> group is selected (kind of like a tabbed group) and also whenever a new 
> record is read while the group is being already being displayed (I don't 

> want to leave data from a prior record in a field that might not be used 

> in the current record).  When I select a new record, the fields are 
> getting cleared 2 or 3 times (the screen blinks) and I can't find all 
> the places that are calling that routine (and in what order).
> 
> It doesn't have to be fancy, just some what to see who's calling who, 
when.
> 
> Len Morgan
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution



----------------------------------------------------------------------------
Clearstream Services S.A.
42 Avenue JF Kennedy, L-1855 Luxembourg
Société anonyme is organised with limited liability
in the Grand Duchy of Luxembourg RC Luxembourg B 60911.


-----------------------------------------
Visit us at http://www.clearstream.com

IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream
International does not accept legal responsibility for the contents
of this message.

The information contained in this e-mail is confidential and may be
legally privileged. It is intended solely for the addressee. If you
are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. Any views expressed in
this e-mail are those of the individual sender, except where the
sender specifically states them to be the views of Clearstream
International or of any of its affiliates or subsidiaries.

Legally required information for business correspondence/
Gesetzliche Pflichtangaben fuer Geschaeftskorrespondenz:
http://deutsche-boerse.com/letterhead

END OF DISCLAIMER



More information about the use-livecode mailing list