Normally, when a run-time error occurs, you are presented with a list of addresses that represent the call stack backtrace, i.e. the addresses of all procedures that were invoked when the run-time error occurred.
This list is not very informative, so there exists a unit that generates the file names and line numbers of the called procedures using the addresses of the stack backtrace. This unit is called lineinfo.
You can use this unit by giving the -gl option to the compiler. The unit will be automatically included. It is also possible to use the unit explicitly in your uses clause, but you must make sure that you compile your program with debug info.
Here is an example program:
program testline; procedure generateerror255; begin runerror(255); end; procedure generateanerror; begin generateerror255; end; begin generateanerror; end.
When compiled with -gl, the following output is generated:
Runtime error 255 at 0x0040BDE5 0x0040BDE5 GENERATEERROR255, line 6 of testline.pp 0x0040BDF0 GENERATEANERROR, line 13 of testline.pp 0x0040BE0C main, line 17 of testline.pp 0x0040B7B1
This is more understandable than the normal message. Make sure that all units you use are compiled with debug info, because if they are not, no line number and filename can be found.