3.3. Listing Lines

[<<<] [>>>]

As you could see the debugger lists some of the lines for you around the actual execution point. To be precise the debugger automatically displays five lines before executing any line: two lines before the actual line, the actual line and two lines after. This slightly altered for the first and the last two lines.

Each line contains a serial number. This number identifies the line for the debugger and when you issue a command that should specify a certain line you can use this number. For example issuing the command r 22 will run until the line denoted by the serial number 22 is ready for execution.

This serial number is not necessarily the line number in the source file. This is the serial number of the line inside the program after all #include and #import statements were performed.

Sometimes you may want to list other lines. To do this simply issue the command l. (This is lower case l, upper case L lists local variables.)

#l

----------------------------------------------------- 001. print "hello\n" >002. a = 3 003. 004. sub MyFunction(t) 005. local a,b,c

----------------------------------------------------- #_

As you can see you got the same listing. This seems to be useless, unless you have examined several variables and the original listing was scrolled off and you need another peek at the current lines.

However the command l is more useful than just this. You can issue an argument to the command specifying the start and the end lines for the listing.

For example:

#l 2-7

----------------------------------------------------- >002. a = 3 003. 004. sub MyFunction(t) 005. local a,b,c 006. 007. b = t + 2

----------------------------------------------------- #_

The command l n-m lists the lines from line n to line m. If you omit the start number then the listing will start at the first line. If you omit the end number the listing will go to the end of the program. If you omit both numbers the command will list all the program lines, for example:

#l -

----------------------------------------------------- 001. print "hello\n" >002. a = 3 003. 004. sub MyFunction(t) 005. local a,b,c 006. 007. b = t + 2 008. print b 009. print " ",t 010. if t > 1 then MyFunction t-1 011. print " *" 012. end sub 013. 014. MyFunction a 015. 016. a = a + 2 017. 018. MyFunction a

----------------------------------------------------- #_

@examining Variables

Stepping forward and examining where the program is actually executing is useful, but not enough. You can also examine the actual content of variables. To do this the command ? can be used. Type ? A at the prompt!

#? a
undef
#_

Step one step ahead again and repeat the command!

#s

----------------------------------------------------- 002. a = 3 003. >004. sub MyFunction(t) 005. local a,b,c 006.

----------------------------------------------------- #? a 3 #_


[<<<] [>>>]