This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Avoid recursivly defined user functions.
- From: Andreas Schwab <schwab at suse dot de>
- To: Michael Snyder <msnyder at redhat dot com>
- Cc: Hilfinger at cs dot berkeley dot edu, Don Howard <dhoward at redhat dot com>,gdb-patches at sources dot redhat dot com
- Date: Thu, 04 Apr 2002 13:16:41 +0200
- Subject: Re: [RFA] Avoid recursivly defined user functions.
- References: <200204032236.OAA20235@tully.CS.Berkeley.EDU><3CAB9346.724C11BB@redhat.com>
Michael Snyder <msnyder@redhat.com> writes:
|> 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...
The simple minded check in Don's patch won't catch many cases of infinite
recursion anyway (mutual recursion, command invocation with arguments).
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."