Re: [RFA] Avoid recursivly defined user functions.

Daniel Jacobowitz
2002-04-11T19:08:28Z

On Thu, Apr 11, 2002 at 10:55:26AM -0700, Don Howard wrote:
> On Tue, 9 Apr 2002, Don Howard wrote:
>
> > On Tue, 9 Apr 2002, Paul Hilfinger wrote:
> >
> > >
> > > > How about something even simpler - track user command depth at runtime?
> > > > Set an absurd limit, like 1024 deep, if we can handle that in a
> > > > normal-sized stack limit. Then complain if we hit it at runtime.
> > >
> > > I completely agree with this. After all, if you were willing to
> > > contemplate outlawing recursion altogether, you certainly won't LOSE
> > > anything by Daniel's approach, and you gain everything you wanted in
> > > the first place---to avoid crashing GDB.
> > >
> > > Paul
> > >
> >
> >
> > I like this approach, also.
> >
>
>
> 2002-04-11 Don Howard <dhoward@redhat.com>
>
> * cli/cli-cmds.c (init_cli_cmds): Add new user settable value:
> max_user_call_depth.
> (init_cmd_lists): Initialize the new value;
> * cli/cli-script.c (execute_user_command): Limit the call depth of
> user defined commands. This avoids a core-dump when user commands
> are infinitly recursive.

Well, I like it.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer