[fpc-pascal] ansistrings, exceptions, pascal call stack and access violations

David Emerson dle3ab at angelbase.com
Thu Nov 4 19:12:12 CET 2004


Peter wrote:

>The quick fix for it will be to disable the dump_stack call after an unhandled exception is found.

That gets rid of the junk, but I still lose the call stack.

>Alternative solution is to retrieve the caller stack at the time an exception is raised. But that will take more cpu time and more memory.

Regarding the system resources -- it would only take that extra cpu time / memory at the time the exception is raised, correct?

(( Our own project does not raise exceptions extensively, but we do want to be able to handle them when they come up, rather than crash out. Maybe we will have one exception in five minutes of execution. ))

Also, I assume this would only work if I raise the exception. If I encounter, e.g., a stack overflow, I guess there wouldn't be a way to get the backtrace until the bug is taken care of? Or can I get it within my exception handling code before reraising?

I'm working on the "alternative solution" ... how do I get my hands on the Relevent Address and frame?

   Writeln (backtrace_text, BackTraceStrFunc(Addr -- ???) );
   Dump_Stack (backtrace_text, frame - ???);


Thanks,
David







More information about the fpc-pascal mailing list