Re: [RFA] Avoid recursivly defined user functions.

Michael Snyder
2002-04-03T23:53:25Z

Paul Hilfinger wrote:
>
> > Executing a recursively defined user function results in a core-dump from
> > gdb:
>
> ...
>
> > The following patch catches recursive user function definitions and
> > disallowes them:
>
> Is the segmentation fault the result of stack overflow?

Yes it is.

> If so, I
> point out that there is an 'if' statement, so recursive commands are
> not necessarily wrong, are they?

No they're not. So it's a judgement call. Is it more important
to allow recursive macros, or to prevent GDB from dumping core?
We're basically running an interpreter here...

I guess one thing we could do would be to impose an arbitrary
(possibly user-settable) stack depth limit. That's more work,
of course...

Michael