The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Location Syntax

Locations are used to indicates places in the source code or the places in bytecode compiled from source code. Locations are used in the listing commands like list or disassemble; they are also used in breakpoint commands like break, tbreak and continue.

To a large extent we emulate gdb's concept of a location.

A location is either some sort of "container" and a position inside that container. A container is either a file name or a method name. And a position is either a line number or a bytecode offset. Bytecode offsets are prefaced with an '@'. So 4 is a line number 4, but @4 is bytecode offset 4.

File names are distinguished from method names purely by semantic means. That its "foo" (without the quotes) could conceivably be either a method or a file name. The debugger does a file check to see if "foo" is a file.

In gdb, locations are often given using a filename a colon and a line number. That is supported here are well. So myfile.rb:5 indicates line 5 of file myfile.rb. But since we also allow method names you can also use gcd:5 to indicate line 5 of function gcd().

Line numbers in methods are not relative to the beginning of the method but relative the beginning of source text that contains the method. This is also how Perl stores line numbers for methods which are shown for example in a backtrace. So all of this hopefully will feel familiar and consistent.