From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: "Agovic, Sanimir" <sanimir.agovic@intel.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/2] Use mi_getopt_silent
Date: Mon, 26 Aug 2013 16:01:00 -0000 [thread overview]
Message-ID: <521B7BB4.4080407@redhat.com> (raw)
In-Reply-To: <521B2B1B.7040309@codesourcery.com>
On 08/26/2013 11:16 AM, Yao Qi wrote:
> 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.
Agreed. Sometimes it's hard to avoid going the throw + swallow-error
route, but in this case it's trivial.
>> 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.
Maybe it's just "silent" that's the confusing term to use. Maybe
mi_getopt_unknown or even something longer would make it less
confusing.
--
Pedro Alves
next prev parent reply other threads:[~2013-08-26 16:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-03 1:48 [PATCH 0/2] New option --skip-unavailable to -stack-list-XXX commands Yao Qi
2013-07-03 1:48 ` [PATCH 2/2] Add options to skip unavailable locals Yao Qi
2013-07-03 4:14 ` asmwarrior
2013-07-03 5:21 ` Yao Qi
2013-07-03 19:22 ` Eli Zaretskii
2013-07-22 1:38 ` Yao Qi
2013-08-01 12:33 ` Pedro Alves
2013-08-01 13:59 ` Yao Qi
2013-08-01 14:47 ` Pedro Alves
2013-08-25 3:43 ` [PATCH 0/2 v2] " Yao Qi
2013-08-25 3:43 ` [PATCH 1/2] Use mi_getopt_silent Yao Qi
2013-08-26 8:58 ` Agovic, Sanimir
2013-08-26 10:18 ` Yao Qi
2013-08-26 16:01 ` Pedro Alves [this message]
2013-08-26 16:22 ` Pedro Alves
2013-08-27 3:30 ` Yao Qi
2013-08-27 11:43 ` Pedro Alves
2013-08-25 3:43 ` [PATCH 2/2] Add options to skip unavailable locals Yao Qi
2013-08-26 16:40 ` Pedro Alves
2013-08-27 5:22 ` Yao Qi
2013-07-03 1:48 ` [PATCH 1/2] Use mi_getopt in mi_cmd_stack_list_locals and mi_cmd_stack_list_variables Yao Qi
2013-07-29 18:17 ` Pedro Alves
2013-07-31 7:01 ` Yao Qi
2013-07-31 12:23 ` Pedro Alves
2013-08-01 6:45 ` Yao Qi
2013-07-29 9:33 ` [ping]: [PATCH 0/2] New option --skip-unavailable to -stack-list-XXX commands Yao Qi
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=521B7BB4.4080407@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=sanimir.agovic@intel.com \
--cc=yao@codesourcery.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