bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unfinite recursion causes segfault


From: Eli Zaretskii
Subject: Re: unfinite recursion causes segfault
Date: Tue, 29 Jan 2008 22:16:04 +0200

> Date: Tue, 29 Jan 2008 08:13:48 +0200
> From: Aharon Robbins <address@hidden>
> Cc: address@hidden
> 
> Also, how would gawk choose a limit? On systems with 128M of memory the
> limit should be smaller than on a system with 2G of memory.
> 
> In this case, causing gawk to core dump is just as effective a way to
> discover a mistaken infinite recursion as is an error message. :-)
> 
> If you have other suggestions, I'll be happy to hear them.

Infinite recursion dumps core because it overflows the run-time
stack.  There are Posix-standard functions to find out how much stack
is available when Gawk starts; then you could detect that stack
overflow is near just before it happens, and bail out gracefully.

Alternatively, you could catch the SIGSEGV and check the stack from
there, to at least produce a useful diagnostics.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]