From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6938 invoked by alias); 24 Aug 2002 00:57:01 -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 6924 invoked from network); 24 Aug 2002 00:57:00 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 24 Aug 2002 00:57:00 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id RAA26221; Fri, 23 Aug 2002 17:50:49 -0700 (PDT) Message-ID: <3D66D9D9.8628BDF@redhat.com> Date: Sat, 24 Aug 2002 02:17:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Don Howard CC: Joel Brobecker , gdb-patches@sources.redhat.com Subject: Re: [RFA] GDB/622 - clear current breakpoint in commands causestrouble References: Content-Type: multipart/mixed; boundary="------------81D681817DBB0BFD992ECEDD" X-SW-Source: 2002-08/txt/msg00788.txt.bz2 This is a multi-part message in MIME format. --------------81D681817DBB0BFD992ECEDD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 1429 Don Howard wrote: > > On Thu, 22 Aug 2002, Michael Snyder wrote: > > > Joel Brobecker wrote: > > > > > 2002-07-31 Joel Brobecker > > > > > > > > * cli/cli-scripts.c (copy_command_lines): New function. > > > > (make_cleanup_free_command_lines): Make this function non static. > > > > > > > > * defs.h (copy_command_lines): Add definition. > > > > (make_cleanup_free_command_lines): Add definition. > > > > > > > > * breakpoint.c (bpstat_do_actions): Execute a temporary copy of > > > > the command-list associated to each breakpoint hit, in order to > > > > avoid accessing a dangling pointer, in case one of the commands > > > > in the list causes the breakpoint to be deleted. > > > It looks OK to me, but I'd like to run it by Don Howard, > > who has looked at this before. Don, this patch looks a lot > > simpler than the one you submitted (which, I think, died on > > the vine (mea culpa)). Do you think it will do the job? > > Yes this patch looks very much like one of my earlier attempts. Joel's > copy_command_lines() is simpler and catches a few bugs that I noticed in > my implementation. One question: is it important to use xstrdup() over > plain strdup()? > > You already pointed out the cleanup issues. Once that is corrected, I'd > recomend it. Joel, Don, What do you think of the attached, to fix the cleanup issue? --------------81D681817DBB0BFD992ECEDD Content-Type: text/plain; charset=us-ascii; name="joel1a.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="joel1a.diff" Content-length: 1429 Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.82 diff -p -r1.82 breakpoint.c *** breakpoint.c 23 Aug 2002 20:49:38 -0000 1.82 --- breakpoint.c 23 Aug 2002 23:47:18 -0000 *************** top: *** 1927,1933 **** breakpoint_proceeded = 0; for (; bs != NULL; bs = bs->next) { ! cmd = bs->commands; while (cmd != NULL) { execute_control_command (cmd); --- 1927,1939 ---- breakpoint_proceeded = 0; for (; bs != NULL; bs = bs->next) { ! struct cleanup *copy_cleanup; ! ! /* Use a temporary copy of the commands, as one command in the list ! may cause this breakpoint and its commands to be deleted. */ ! cmd = copy_command_lines (bs->commands); ! copy_cleanup = make_cleanup_free_command_lines (&cmd); ! while (cmd != NULL) { execute_control_command (cmd); *************** top: *** 1945,1954 **** goto top; else bs->commands = NULL; - } ! executing_breakpoint_commands = 0; ! discard_cleanups (old_chain); } /* This is the normal print function for a bpstat. In the future, --- 1951,1960 ---- goto top; else bs->commands = NULL; ! do_cleanups (copy_cleanup); ! } ! do_cleanups (old_chain); } /* This is the normal print function for a bpstat. In the future, --------------81D681817DBB0BFD992ECEDD--