[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Debugging tool
Fred Wolfe <firstname.lastname@example.org>
Re: st: Debugging tool
Thu, 20 Aug 2009 10:43:08 -0500
I strongly, strongly, strongly support this request.
On Thu, Aug 20, 2009 at 9:10 AM, WLJ van Putten<email@example.com> wrote:
> Debugging of Stata programs can be a very tedious and complicated process,
> especially in case of long and/or nested programs.
> Where is the bug? In the main program or in a subroutine or a program
> somewhere down the line? Is there a bug in program code itself or is it due
> to wrong or missing content of certain macros in specific situations when
> the program is applied?
> There are a number of approaches that one can follow and combine for
> debugging. E.g.:
> - set trace on before starting the program or add a set trace on line to the
> program at a point before where an error occurs.
> - add noisily display "text... " lines to an ado file to find out where
> the error occurs
> - or add "global X<i> ...." lines to the program and later inspect the
> content of these global macros
> - set pause on and add pause commands to the ado file
> - set a log on before setting trace on and use an editor to go through the
> lines of code in the resulting log file
> - close the result window first when logging the output to speed up the
> But still it can be very time consuming to just locate the point where the
> error occurs.
> I would like to have a tool (say with set debug on) that shows (without set
> trace on) after a command that ends in an error
> (1) the final command line [c1] that produced the error without and with
> macro substitution - just like after set trace on, followed by
> (2) the command line [c2] that called c1 without and with macro
> substitution of that line, followed by
> (3) the command line [c3] that called c2 without and with macro
> substitution, followed by
> .... etcetera till the inital command given.
> Such a tool can be used as the first step to locate the error. The macro
> substituted lines may already give sufficient clues to solve the problem.
> Otherwise one could set a trace on at a suitable point in the program or one
> of the called programs for further detection.
> To write such a tool is beyond the powers of a simple mortal user of Stata,
> and can only be done by StataCorp.
> I had proposed this to Stata and received some useful comments from Kerry
> Kammire from Stata Technical Support. He has passed on my request to Stata
> Development. He told me that the development of such a tool gets a higher
> vpriority if it is supported by many users of Stata.
> If any of you support my request for such a debugging tool (or a smarter
> one!) please let this be known to StataCorp (or) through Statalist.
> Wim van Putten
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
National Data Bank for Rheumatic Diseases
NDB Office +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
* For searches and help try: