From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18198 invoked by alias); 22 Oct 2002 17:53:46 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18148 invoked from network); 22 Oct 2002 17:53:45 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 22 Oct 2002 17:53:45 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g9MHWQw24700 for ; Tue, 22 Oct 2002 13:32:26 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9MHrif10537 for ; Tue, 22 Oct 2002 13:53:44 -0400 Received: from lindt.uglyboxes.com (vpn50-13.rdu.redhat.com [172.16.50.13]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g9MHriw02960 for ; Tue, 22 Oct 2002 13:53:44 -0400 Date: Tue, 22 Oct 2002 10:53:00 -0000 From: Keith Seitz X-X-Sender: keiths@lindt.uglyboxes.com To: gdb-patches@sources.redhat.com Subject: Re: [RFA/mi] Fix "-thread-select 123456789" test (fwd) In-Reply-To: <15797.31697.71428.102586@localhost.redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-10/txt/msg00411.txt.bz2 On Tue, 22 Oct 2002, Elena Zannoni wrote: > Sorry, this one slipped. Yes, go ahead. Committed. Thanks for the look. Keith > > ---------- Forwarded message ---------- > > Date: Tue, 24 Sep 2002 12:53:36 -0700 (PDT) > > From: Keith Seitz > > To: gdb-patches@sources.redhat.com > > Subject: [RFA/mi] Fix "-thread-select 123456789" test > > > > Hi, > > > > Now that the mi-pthreads.exp tests are committed, this patch fixes one of > > the failures, which demonstrates that when an error occurs switching > > threads, MI was not able to correctly propagate an error message to the > > user. > > > > This happens because the MI function is using a wrapped gdb function, > > gdb_thread_select. This function returns <0 when an error occurs. The > > wrapped function can return either a gdb failure code (like RETURN_ERROR) > > or a wrapper failures (GDB_RC_FAIL). In both cases, mi_cmd_thread_select > > was returnging MI_CMD_CAUGHT_ERROR, which is only valid in the first case. > > In the latter, ther error message is already in mi_error_message, and it > > should return MI_CMD_ERROR. > > > > You can see this by looking at mi-pthreads.exp's "-thread-select > > 123456789" test: > > > > (gdb) > > -thread-select 123456789 > > &"Thread ID 123456789 not known.\n" > > ^done > > (gdb) > > > > Clearly, the correct answer should have ended with '^error,msg="Thread ID > > 123456789 not known."'. > > > > Keith > > > > ChangeLog > > 2002-09-24 Keith Seitz > > > > * mi-main.c (mi_cmd_thread_select): Only return MI_CMD_CAUGHT_ERROR > > when we really did catch an error(). If we got GDB_RC_FAIL, return > > MI_CMD_ERROR instead. > > > > Patch > > Index: mi/mi-main.c > > =================================================================== > > RCS file: /cvs/src/src/gdb/mi/mi-main.c,v > > retrieving revision 1.31 > > diff -p -r1.31 mi-main.c > > *** mi/mi-main.c 11 Sep 2002 21:49:04 -0000 1.31 > > --- mi/mi-main.c 24 Sep 2002 19:44:32 -0000 > > *************** mi_cmd_thread_select (char *command, cha > > *** 244,251 **** > > else > > rc = gdb_thread_select (uiout, argv[0]); > > > > ! if (rc == GDB_RC_FAIL) > > return MI_CMD_CAUGHT_ERROR; > > else > > return MI_CMD_DONE; > > } > > --- 244,255 ---- > > else > > rc = gdb_thread_select (uiout, argv[0]); > > > > ! /* 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_CAUGHT_ERROR; > > + else if ((int) rc >= 0 && rc == GDB_RC_FAIL) > > + return MI_CMD_ERROR; > > else > > return MI_CMD_DONE; > > } > > >