Need a reliable way to determine the line of code being executed
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Need a reliable way to determine the line of code being executed

From: Mark Wege <mwege@csc.R_E_M_O_V_E.com>
Date: Tue Feb 28 2006 - 19:49:29 CET

I was wondering if anyone knows of a reliable method of obtaining the
line of code being executed; specifically, I want to see how a proc was
called from within that proc.

I had hoped to use "info level" to get the information I need, but it
shows the call after it has been parsed, by which time it has "lost" the
information I need.

I'm probably not explaining this well, so here's an example:

     set myVar var1

     set res [MyProc $myVar]

 From within the proc, the "info level" command will give me:

     MyProc var1

but I need to obtain the original line of code, i.e.:

     set res [MyProc $myVar]

Ultimately, what I'm need to know is that the result of the call to
MyProc was stored in the variable "res", and I was hoping to be able to
know this without modifying all calls to the procedure to pass the
variable name in as a parameter (or storing it in a global variable).

I'm looking for this because I need to fix an issue in a large
application (many files in many directories containing over 500,000
lines of Tcl code) where a change in the underlying architecture has
required us to periodically refresh the contents of the variable with
updated information, and I don't want to manually change all of the
calls to several procedures in all of this code.

By RELIABLY doing the refresh from within the procedures, I hope to
reduce the amount of development time and the very large amount of
regression testing that will need to be done.

Any suggestions would be very welcome.

      Mark
Received on Sun Apr 30 02:17:56 2006