Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: st: Debugging tool


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: Debugging tool
Date   Thu, 20 Aug 2009 17:47:39 +0200

<> 

Re debugging: -ssc d tr- by Ben Jann has helped me a lot...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Fred Wolfe
Gesendet: Donnerstag, 20. August 2009 17:43
An: [email protected]
Betreff: Re: st: Debugging tool

I strongly, strongly, strongly support this request.

Fred Wolfe

On Thu, Aug 20, 2009 at 9:10 AM, WLJ van Putten<[email protected]>
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
> process
>
> 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/
>



-- 
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office  +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
[email protected]

*
*   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/


*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index