Frank Heckenbach wrote:
willett wrote:
I'm using gpc version 20051116, based on gcc-3.4.5. Impressive update!
It is very nice to have the runtime error detection. But of course it means some new errors have to be dealt with, one way or another. An old program of mine is now getting...
out of range (error #300 at 2c57)
Trace/BPT trap
Trying to get a less cryptic error report, maybe one with the procedure stack at point of error, I compile as:
gp -mtraceback=full progname
But this does not add anything to the information in the out of range error. Also, it would be nice to have a list of error messages, so that error #300 could be looked up.
The list is only hidden in rts/error.pas, but the above message says it already: It's a range-check error.
Any thought on how to access more information for runtime errors? (like a simple traceback of procedure calls)..
For errors that GPC catches (such as this one, as oppose to real crashes, segmentation faults, bus errors, etc.), you can use the command line option:
--gpc-rts=-Efoo
to write such a traceback to file foo, or
--gpc-rts=-F42
to write it to FD #42 (for any value of 42, such as 2 for standard error).
You can then use addr2line to translate the numeric positions into line numbers. (Also to the one in the error message, here 2c57; this might already tell you what you need to know.)
The gpc-run script that comes with GPC automates this, but AFAIK it's not well tested, mainly by myself, and only on Unix compatible systems):
gpc-run your-program your-arguments
But also see http://www.gnu-pascal.de/crystal/gpc/en/mail13038.html, it's now the default on Mac OS X.
Regards,
Adriaan van Os