From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26728 invoked by alias); 27 Mar 2007 19:54:24 -0000 Received: (qmail 26719 invoked by uid 22791); 27 Mar 2007 19:54:23 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Mar 2007 20:54:17 +0100 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id EB3E54B267; Tue, 27 Mar 2007 14:54:15 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id 320554B262; Tue, 27 Mar 2007 14:54:15 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.63) (envelope-from ) id 1HWHkE-0002W2-Nm; Tue, 27 Mar 2007 15:54:14 -0400 Date: Tue, 27 Mar 2007 19:54:00 -0000 From: Daniel Jacobowitz To: Nick Roberts Cc: Denis PILAT , gdb-patches Subject: Re: [RFC] -thread-info new command Message-ID: <20070327195414.GN28164@caradoc.them.org> Mail-Followup-To: Nick Roberts , Denis PILAT , gdb-patches References: <45FE9E6A.3030906@st.com> <17919.15500.439138.600411@kahikatea.snap.net.nz> <17919.20575.286260.761826@kahikatea.snap.net.nz> <20070320031409.GA7336@caradoc.them.org> <17919.21588.93918.661753@kahikatea.snap.net.nz> <17921.40699.742164.983281@kahikatea.snap.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17921.40699.742164.983281@kahikatea.snap.net.nz> User-Agent: Mutt/1.5.14+cvs20070313 (2007-03-13) 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: 2007-03/txt/msg00277.txt.bz2 On Thu, Mar 22, 2007 at 09:09:15AM +1200, Nick Roberts wrote: > I've gone through the archives to try to understand the changes. The above > message says: > > Well we need to propagate the error message back to > captured_mi_execute_command. > > Actually there are currently two ways to catch an error in MI: > > 1) Using error () and catch_exception. > > 2) Using MI_CMD_ERROR and mi_error_message. > > The first gets caught in mi_execute_command and the error message is stored > in result.message. The second goes back to captured_mi_execute_command and > the error message is manually stored in mi_error_message. > > I think that only one method should be used and this should be the first one. Once upon a time there were supposed to be more things using "libgdb" - these gdb_* wrapper functions. It didn't come to pass. For now can we do the minimal fix for this problem? I apologize I was never clear enough about what I meant when I said that, so here's a patch. Before: -break-insert * &"Argument required (expression to compute).\n" ^done After: -break-insert * &"Argument required (expression to compute).\n" ^error,msg="Argument required (expression to compute)." I'm running the testsuite on this now. -- Daniel Jacobowitz CodeSourcery 2007-03-27 Daniel Jacobowitz * breakpoint.c (gdb_breakpoint_query): Really return an enum gdb_rc. (gdb_breakpoint): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (do_captured_thread_select): Likewise. * mi/mi-main.c (mi_cmd_thread_select): Expect an enum gdb_rc. (mi_cmd_thread_list_ids): Remove bogus initialization. Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.242 diff -u -p -r1.242 breakpoint.c --- breakpoint.c 9 Mar 2007 16:20:42 -0000 1.242 +++ breakpoint.c 27 Mar 2007 19:51:50 -0000 @@ -3755,8 +3755,11 @@ gdb_breakpoint_query (struct ui_out *uio args.bnum = bnum; /* For the moment we don't trust print_one_breakpoint() to not throw an error. */ - return catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args, - error_message, RETURN_MASK_ALL); + if (catch_exceptions_with_msg (uiout, do_captured_breakpoint_query, &args, + error_message, RETURN_MASK_ALL) < 0) + return GDB_RC_FAIL; + else + return GDB_RC_OK; } /* Return non-zero if B is user settable (breakpoints, watchpoints, @@ -5598,8 +5601,11 @@ gdb_breakpoint (char *address, char *con args.tempflag = tempflag; args.thread = thread; args.ignore_count = ignore_count; - return catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args, - error_message, RETURN_MASK_ALL); + if (catch_exceptions_with_msg (uiout, do_captured_breakpoint, &args, + error_message, RETURN_MASK_ALL) < 0) + return GDB_RC_FAIL; + else + return GDB_RC_OK; } Index: thread.c =================================================================== RCS file: /cvs/src/src/gdb/thread.c,v retrieving revision 1.51 diff -u -p -r1.51 thread.c --- thread.c 28 Feb 2007 17:35:01 -0000 1.51 +++ thread.c 27 Mar 2007 19:51:50 -0000 @@ -286,8 +286,10 @@ do_captured_list_thread_ids (struct ui_o enum gdb_rc gdb_list_thread_ids (struct ui_out *uiout, char **error_message) { - return catch_exceptions_with_msg (uiout, do_captured_list_thread_ids, NULL, - error_message, RETURN_MASK_ALL); + if (catch_exceptions_with_msg (uiout, do_captured_list_thread_ids, NULL, + error_message, RETURN_MASK_ALL) < 0) + return GDB_RC_FAIL; + return GDB_RC_OK; } /* Load infrun state for the thread PID. */ @@ -707,8 +709,10 @@ do_captured_thread_select (struct ui_out enum gdb_rc gdb_thread_select (struct ui_out *uiout, char *tidstr, char **error_message) { - return catch_exceptions_with_msg (uiout, do_captured_thread_select, tidstr, - error_message, RETURN_MASK_ALL); + if (catch_exceptions_with_msg (uiout, do_captured_thread_select, tidstr, + error_message, RETURN_MASK_ALL) < 0) + return GDB_RC_FAIL; + return GDB_RC_OK; } /* Commands with a prefix of `thread'. */ Index: mi/mi-main.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.94 diff -u -p -r1.94 mi-main.c --- mi/mi-main.c 3 Feb 2007 05:41:15 -0000 1.94 +++ mi/mi-main.c 27 Mar 2007 19:51:50 -0000 @@ -253,11 +253,7 @@ mi_cmd_thread_select (char *command, cha else rc = gdb_thread_select (uiout, argv[0], &mi_error_message); - /* RC is enum gdb_rc if it is successful (>=0) - enum return_reason if not (<0). */ - if ((int) rc < 0 && (enum return_reason) rc == RETURN_ERROR) - return MI_CMD_ERROR; - else if ((int) rc >= 0 && rc == GDB_RC_FAIL) + if (rc == GDB_RC_FAIL) return MI_CMD_ERROR; else return MI_CMD_DONE; @@ -266,7 +262,7 @@ mi_cmd_thread_select (char *command, cha enum mi_cmd_result mi_cmd_thread_list_ids (char *command, char **argv, int argc) { - enum gdb_rc rc = MI_CMD_DONE; + enum gdb_rc rc; if (argc != 0) {