Re: retrieving line number in case of error - "simple debugger"



Hi,

Wojciech Kocjan wrote:

True. But then again, why not writing (heck, even a pure Tcl) Tcl parser that just splits code into lines and inserts ::something::setLine 1234 (where 1234 is the line number in the source) before every invocation. I think this is what TclPro/TDK does, but they do it integrated with an IDE.

Mmhh... If TclPro does insert in scripts lines such as: ::something::setLine 1234 in order to retrieve line numbers, it is one of the best solution so far!


However, doing this may not be that easy. For example, consider the following script :

1	if 1 {
2		puts Hello
3		set a List { 1 2 4
4			5 6 7
5		}
6		puts Hello2
7	}

How to make a difference between

2		puts Hello

and

4			5 6 7

so that "::something::setLine **** " is inserted before line 3, and not befoire line 4 ?

Basically, it is necessary to know if a "new line nested in a command" (such as the "if" command) is inside a list of commands, inside or a list of variables... which is not possible before executing the nesting command, I think !

Wow ! Things are geting difficult for tcl newcommer like I am ! :)

It seems that the best for me to do is :
1/ forget this till the 'feature request' I posted on source forge is treated
or 2/ use a debug package



By the way, do you know if TclPro really displays 'correct' line numbers ? If it does, I guess I should make a few reverse engineering !


Thanks for all your replies I read carefully, All the best,

NC
.