From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31196 invoked by alias); 26 Aug 2013 10:18:16 -0000 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 Received: (qmail 31182 invoked by uid 89); 26 Aug 2013 10:18:15 -0000 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Aug 2013 10:18:15 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE,SPF_HELO_FAIL autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VDtsA-0006Qo-I0 from Yao_Qi@mentor.com ; Mon, 26 Aug 2013 03:18:10 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 26 Aug 2013 03:18:10 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Mon, 26 Aug 2013 03:18:09 -0700 Message-ID: <521B2B1B.7040309@codesourcery.com> Date: Mon, 26 Aug 2013 10:18:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: "Agovic, Sanimir" CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH 1/2] Use mi_getopt_silent References: <51FA557F.5@redhat.com> <1377402123-3740-1-git-send-email-yao@codesourcery.com> <1377402123-3740-2-git-send-email-yao@codesourcery.com> <0377C58828D86C4588AEEC42FC3B85A71764DC1D@IRSMSX105.ger.corp.intel.com> In-Reply-To: <0377C58828D86C4588AEEC42FC3B85A71764DC1D@IRSMSX105.ger.corp.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-08/txt/msg00732.txt.bz2 On 08/26/2013 04:58 PM, Agovic, Sanimir wrote: > I`d rather catch the exception in mi_cmd_stack_list_args to prevent the > error to bubble up to upper layers. This requires the use of > throw_error (NOT_FOUND_ERROR, ...) instead of error (...) in mi_getopt > to catch the right exception (*) and re-throw otherwise. Sanimir, thanks for your comments. I am not inclined to use exception here because exception handling in GDB is poor. On the other hand, I don't like using exception to control the program flow. In some commands, there is no unknown options, and in other commands, there may be unknown options. Both of them are expected. In the former, GDB can throw an error, and in the later, GDB can silently return -1. > Due to the poor exception handling in gdb this may lead to some boilerplate > code. On the other side it keeps the interface simple & consistent > e.g. (*) in the patch below mi_getopt_silent may still be verbose/throw. Yes, mi_getopt_silent may throw error when the argument of an option is missing, because it is wrong. "silent" here is only for unknown options, which is expected in some commands. -- Yao (齐尧)