[fpc-devel] time for dumping stacktrace, when using dwarf.

Martin lazarus at mfriebe.de
Tue Nov 10 15:52:42 CET 2009

Vincent Snijders wrote:
> Micha Nelissen schreef:
>> Schatzl Thomas wrote:
>>> Improving upon that should be trivial, all reading from the debug 
>>> input has been encapsuled in the two ReadNext() methods in the file 
>>> mentioned. It should be easy to make them to read from a (static?) 
>>> buffer that is filled blockwise; note that a static buffer may give 
>>> headaches for MT programs, and you are strongly discouraged to do 
>>> memory allocation during crashes...
>> Allocating that buffer on the stack isn't sufficient?
> That's not easy when the exception is raised in case of a stack overflow.

I was also thinking, maybe have an
buffer: Array[0..999] locally in GetLineInfo and pass a pointer around?

There is plenty of other stuff already on the stack, and there are calls 
made to functions which need place on the stack.
So if a stackoverflow occurs, then how does it work anyway?
Only problem will be if an error occurs with minimum free stack left. 
Every byte allocated slightly increases the chance that the exception 
handler will hit the limit.

Another possibility would be a global (cross thread) pre-allocated 
buffer, and an exception+thread-save way to mark it as in use => the 
first thread that is dumbing, will grab it, other threads go byte by 
byte => but it is a lot of work, since it is a dual implementation (I 
don't like it).

Just another question:  IS it thread save at the moment:
OpenDwarf, uses a global variable...


More information about the fpc-devel mailing list