Is there a way to show the faulty code line instead of the memory address when a runtime error occurs in VSCode?

Refresh

March 2019

Views

28 time

1

See the Question in the title:

Runtime error 201 at $0000000100001D42 $0000000100001D42

Is there a way to show the faulty code line instead of the memory address?

Thanks for the Help

1 answers

0

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.

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.