willett wrote:
I'm looking for a very simple debugging info from a running gpc program. without getting into a debugger etc. I'm just using gp from command line.
By default, most errors get the uninformative message "Segmentation fault". I would think ther would be some compiler option for more information at time of program failure, for example, the procedure name in which the error occurred, a procedure traceback, and/or a line number at which the error occurred.
But I've searched through both the gpc and gcc manuals, and don't see this. Is it there and I'm missing it?
And, if anything like this is available, an improvement to the gpc manual would be to mention this as a simple option in:
3.2.3 How do I debug my Pascal programs?
On Mac OS X try the following:
• compile with debug information (pass -g) • start /Applications/Utilities/Console.app and open a CrashReporter log • you will get a backtrace with line numbers and procedure names.
Unfortunately, there is a bug in the gpc runtime for the last OS X release, so you will probably see something like
0 a.out 0x0000ab50 _p_FileHandle + 0x4 (files.pas:1033) 1 a.out 0x000047c4 _p_WriteErrorMessage + 0xb0 (error.pas:732) 2 a.out 0x00004aa0 _p__rts_Error_S22_Writestackdump + 0x2a0 (error.pas:754) 3 a.out 0x0000543c _p_EndRuntimeError + 0x38 (error.pas:844) 4 a.out 0x00005520 _p_RuntimeError + 0xbc (error.pas:853) 5 a.out 0x00003b64 _p_GetErrorMessage + 0 (error.pas:586)
I have to update the distribution.
Regards,
Adriaan van Os