From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32641 invoked by alias); 6 Jul 2006 13:30:49 -0000 Received: (qmail 32630 invoked by uid 22791); 6 Jul 2006 13:30:49 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Thu, 06 Jul 2006 13:30:46 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FyTwK-00055D-VQ; Thu, 06 Jul 2006 09:30:45 -0400 Date: Thu, 06 Jul 2006 13:30:00 -0000 From: Daniel Jacobowitz To: Andrew STUBBS Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix segfault on empty else Message-ID: <20060706133044.GC18827@nevyn.them.org> Mail-Followup-To: Andrew STUBBS , gdb-patches@sourceware.org References: <44980741.4040404@st.com> <20060620201752.GA1453@nevyn.them.org> <4499247B.7050404@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4499247B.7050404@st.com> User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00031.txt.bz2 On Wed, Jun 21, 2006 at 11:50:35AM +0100, Andrew STUBBS wrote: > How about the attached? It is somewhat tricky trying to reliably > reproduce the problem without valgrind, as you say. > > I have put in a few commands that are intended to run through the same > code and will, most likely, allocate memory in the same place, in order > to ensure that the crash occurs. This is a little hopeful, but what else > can I do? > > This works for me, but could you please confirm that it works in your > setup/host (without the patch to fix the problem of course). :REVIEWMAIL: Works fine for me - very clever. This patch is OK. I'd recommend two changes, at your discretion: > +send_gdb "if 1\necho true\\n\nelse\necho false\\n\nend\n" Due to the patterns you're matching, this is safe, but in general it's bad style to use send_gdb without a matching gdb_expect. If you use gdb_test with the third argument empty, it will not be registered as a "test", and no pass message will be issued - unless the test fails, that is. So this is useful for tests which aren't part of the testcase, and are always assumed to pass. > +# with true condition > +send_gdb "if 1\nelse\nend\necho got here\\n\n" > +gdb_expect { gdb_test_multiple is a little nicer here. You can still supply your own eof handler; the only difference is that it will pick up other quirky bits like internal error messages (and the default timeout handler should be fine for you here). -- Daniel Jacobowitz CodeSourcery