This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Use mi_getopt_silent


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]