PC to Line Number

Top  Previous  Next

The PC to Line Number option translates the I2L Program Counter to a source code line number, and vice versa. This can be useful for debugging runtime errors in a stand-alone program where the only information you may have is the PC where the error occurred.


To access the PC to Line number translations, select the Debug -> PC/Line Number List option from the menu bar. The program will display a table that shows the line numbers and their corresponding PC values. Note: The list will be empty unless you have compiled the program.




The list shows the source code line number and the corresponding I2L Program Counter. This enables you to translate a source code line number to a PC, and vice versa. You will notice that in many instances several PC's correspond to one line of source code. This is because each line of source code can generate multiple I2L opcodes.


You can double click on any line in the list and the program will take you to the line and column number in the Source Editor that corresponds to the Program Counter position.


As example of using the list, here is an I2L Runtime Error in a stand-alone program.




The dialog shows that a divide-by-zero error occurred at the program counter of $08. Looking at the PC To Line Number dialog, you can see that the error occurred near line 8 of the source code. Looking at the source code, you will see that there is a divide-by-zero statement on that line.