How do I find the instruction which causes the error 'Array Index Out of Bounds'?

Hello, my question is that…

How do I find the instruction which causes the error ‘Array Index Out of Bounds’?

I have the direction that caused error. Example: 04:e05e

The address you mentioned can be tracked down by looking at the map and lst files that can be generated during compilation. The map file is always generated, to get lst files you need to enable List File generation on the Options/Project Options/Compiler settings box.

The map file will show a list of addresses followed by names of functions or variables that have been located there. For instance, here is a snippet from a map file (dotted areas would be white space in the actual file):

0004:e6f8 . . . * . . . F_mul . . . . . . . . . . \MUTILFP.LIB
0004:e7b3 . . 1418 . fat_EnumPartition . . \FAT.LIB
0004:ed3d . . 381 . . _fat_PartCalc . . . . \FAT.LIB
0004:eeba . . 238 . . gets . . . . . . . . . . \STDIO.LIB

So if you were getting 04:e853 as your address of failure, this would indicate that the run-time error is happening in the fat_EnumPartition function. From here, you can look at the listing file .lst (remember to enable) which can show you the instruction within the file where the error is occuring. Either of these two files (.map or .lst) can be used to narrow down where an error is occuring and from there you can either use breakpoints to try to actually capture the error occuring, or inspect the code in the area to see if you can identify which variable is exceeding an array boundary.

It seems version 9.21 gave the line number (in C code) of the array index error, and version 9.52 (which I’m using now) gives the code as stated by the original poster, example 04:e05e.

Is there a way to set the debugger to give the line number as in earlier versions without having to view map files and lst files? That seems a lot simpler. If not, why the change? Thanks for any help. VA