Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Andrew STUBBS <andrew.stubbs@st.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix segfault on empty else
Date: Thu, 06 Jul 2006 13:30:00 -0000	[thread overview]
Message-ID: <20060706133044.GC18827@nevyn.them.org> (raw)
In-Reply-To: <4499247B.7050404@st.com>

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


  reply	other threads:[~2006-07-06 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-20 14:34 Andrew STUBBS
2006-06-20 20:17 ` Daniel Jacobowitz
2006-06-21 10:50   ` Andrew STUBBS
2006-07-06 13:30     ` Daniel Jacobowitz [this message]
2006-07-06 16:19       ` Andrew STUBBS
2006-07-06 16:23         ` Daniel Jacobowitz
2006-07-07 11:08           ` Andrew STUBBS
2006-07-07 12:39             ` Daniel Jacobowitz
2006-07-07 13:36               ` Andrew STUBBS

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060706133044.GC18827@nevyn.them.org \
    --to=drow@false.org \
    --cc=andrew.stubbs@st.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox