From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29740 invoked by alias); 4 Apr 2008 12:34:37 -0000 Received: (qmail 29730 invoked by uid 22791); 4 Apr 2008 12:34:36 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 04 Apr 2008 12:34:15 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Jhl7U-0000lC-V4 for gdb-patches@sources.redhat.com; Fri, 04 Apr 2008 12:34:12 +0000 Received: from 78.158.192.230 ([78.158.192.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 04 Apr 2008 12:34:12 +0000 Received: from ghost by 78.158.192.230 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 04 Apr 2008 12:34:12 +0000 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: cleanup mi error message handling Date: Fri, 04 Apr 2008 13:33:00 -0000 Message-ID: References: <200803241830.11759.pedro@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit User-Agent: KNode/0.10.5 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00096.txt.bz2 Pedro Alves wrote: > Index: src/gdb/mi/mi-main.c > =================================================================== > --- src.orig/gdb/mi/mi-main.c   2008-03-23 19:56:34.000000000 +0000 > +++ src/gdb/mi/mi-main.c        2008-03-23 20:00:02.000000000 +0000 > @@ -96,7 +96,6 @@ static int do_timings = 0; >  /* The token of the last asynchronous command.  */ >  static char *last_async_command; >  static char *previous_async_command; > -char *mi_error_message; >   >  extern void _initialize_mi_main (void); >  static enum mi_cmd_result mi_cmd_execute (struct mi_parse *parse); > @@ -109,7 +108,7 @@ static void mi_exec_async_cli_cmd_contin >   >  static int register_changed_p (int regnum, struct regcache *, >                                struct regcache *); > -static int get_register (int regnum, int format); > +static void get_register (int regnum, int format); >   >  /* Command implementations.  FIXME: Is this libgdb?  No.  This is the MI >     layer that calls libgdb.  Any operation used in the below should be > @@ -219,10 +218,8 @@ enum mi_cmd_result >  mi_cmd_exec_interrupt (char *args, int from_tty) >  { >    if (!target_executing) > -    { > -      mi_error_message = xstrprintf ("mi_cmd_exec_interrupt: Inferior not executing."); > -      return MI_CMD_ERROR; > -    } > +    error ("mi_cmd_exec_interrupt: Inferior not executing."); > + >    interrupt_target_command (args, from_tty); >    if (last_async_command) >      fputs_unfiltered (last_async_command, raw_stdout); > @@ -242,38 +239,40 @@ enum mi_cmd_result >  mi_cmd_thread_select (char *command, char **argv, int argc) >  { >    enum gdb_rc rc; > +  char *mi_error_message; >   >    if (argc != 1) > +    error ("mi_cmd_thread_select: USAGE: threadnum."); > + > +  rc = gdb_thread_select (uiout, argv[0], &mi_error_message); > + > +  if (rc == GDB_RC_FAIL) >      { > -      mi_error_message = xstrprintf ("mi_cmd_thread_select: USAGE: threadnum."); > -      return MI_CMD_ERROR; > +      make_cleanup (xfree, mi_error_message); > +      error ("%s", mi_error_message); Oh, so first gdb_thread_select catches exception and converts it to string, and then we throw that string again? Eek, but guess we can fix that with a separate patch. This patch is OK. Please be sure to re-run the MI testsuite before checking in, though, as there were various testsuite changes recently. Thanks, Volodya