Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Marc Khouzam <marc.khouzam@ericsson.com>
Cc: "'gdb-patches\@sourceware.org'" <gdb-patches@sourceware.org>
Subject: Re: [MI] Segfault using 'interpreter-exec mi'
Date: Thu, 02 Dec 2010 16:35:00 -0000	[thread overview]
Message-ID: <m3fwugku9u.fsf@fleche.redhat.com> (raw)
In-Reply-To: <F7CE05678329534C957159168FA70DEC572E7598F1@EUSAACMS0703.eamcs.ericsson.se>	(Marc Khouzam's message of "Thu, 25 Nov 2010 15:53:55 -0500")

>>>>> "Marc" == Marc Khouzam <marc.khouzam@ericsson.com> writes:

Marc> I got a segfault when using 'interpreter-exec mi' and getting an
Marc> error result.  I believe I tracked it down to mi_parse().  From
Marc> what I can see, we cannot call error() from mi_parse() because it
Marc> does not catch exceptions.

Marc> Note that the segfault does not happen in full MI mode, I think because
Marc> we are in the correct interpreter for output, however, the MI command
Marc> does not get the proper ^error and requires the user to enter a new line
Marc> to get the ^done.

Thanks for the patch.

Marc> The below patch removes the calls to error() and uses fprintf_unfiltered.
Marc> Because of the comment
Marc> /* FIXME: This should be a function call. */
Marc> I took the opportunity to make a method mi_parse_error().

I don't mind this approach, but I think it is probably better to just
change mi_parse to use exceptions like the rest of gdb.  Then the caller
can handle them, just like it does for exceptions occurring in the
actual MI command.

The reason I think this is better is that a rule like "this code cannot
call error" is reasonably difficult to enforce in gdb.

What do you think of that?

A quick nit about the patch itself.

Marc> +void
Marc> +vmi_parse_error (struct mi_parse *parse, const char *format, va_list args)

The new functions need introductory comments.

I would have made them both static.

Tom


  reply	other threads:[~2010-12-02 16:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 20:54 Marc Khouzam
2010-12-02 16:35 ` Tom Tromey [this message]
2010-12-06 21:35   ` Marc Khouzam
2010-12-06 21:41     ` Tom Tromey
2010-12-07 20:32     ` Tom Tromey
2010-12-07 21:08       ` Tom Tromey
2010-12-07 21:39       ` Marc Khouzam
2010-12-07 21:57         ` Tom Tromey
2010-12-08  1:20           ` Marc Khouzam
2010-12-09 19:15             ` Tom Tromey

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=m3fwugku9u.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=marc.khouzam@ericsson.com \
    /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