From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20400 invoked by alias); 3 Apr 2002 22:09:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 20385 invoked from network); 3 Apr 2002 22:09:39 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 3 Apr 2002 22:09:39 -0000 Received: from theotherone.redhat-remotie.org (taarna.cygnus.com [205.180.230.102]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id OAA20411 for ; Wed, 3 Apr 2002 14:09:37 -0800 (PST) Received: from localhost (localhost.fidalgo.net [127.0.0.1]) by theotherone.redhat-remotie.org (Postfix) with ESMTP id B42B5BB255 for ; Wed, 3 Apr 2002 14:10:21 -0800 (PST) Date: Wed, 03 Apr 2002 14:09:00 -0000 From: Don Howard X-X-Sender: To: Subject: [RFA] Avoid recursivly defined user functions. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-04/txt/msg00076.txt.bz2 Executing a recursively defined user function results in a core-dump from gdb: (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". >foo >end (gdb) foo Segmentation fault (core dumped) The following patch catches recursive user function definitions and disallowes them: 2002-04-03 Don Howard * cli/cli-script.c (define_command): Avoid recursivly defined user commands. Index: cli-script.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-script.c,v retrieving revision 1.11 diff -p -u -w -r1.11 cli-script.c --- cli-script.c 2002/03/17 19:53:39 1.11 +++ cli-script.c 2002/04/03 22:07:36 @@ -1099,6 +1099,13 @@ define_command (char *comname, int from_ sprintf (tmpbuf, "Type commands for definition of \"%s\".", comname); cmds = read_command_lines (tmpbuf, from_tty); + { + struct command_line *c; + for (c=cmds; c; c=c->next) + if (strcmp (c->line, comname) == 0) + error ("Recursive user command definitions are not supported."); + } + if (c && c->class == class_user) free_command_lines (&c->user_commands); -- dhoward@redhat.com gdb engineering