This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: ping: [PATCH] Accept convenience variable in commands -break-passcount and -break-commands
- From: Yao Qi <yao at codesourcery dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 20 Feb 2014 15:19:55 +0800
- Subject: Re: ping: [PATCH] Accept convenience variable in commands -break-passcount and -break-commands
- Authentication-results: sourceware.org; auth=none
- References: <1390566031-30153-1-git-send-email-yao at codesourcery dot com> <52F381E9 dot 3060100 at codesourcery dot com> <52FC52A2 dot 9000006 at codesourcery dot com> <20140219085526 dot GA9920 at adacore dot com>
On 02/19/2014 04:55 PM, Joel Brobecker wrote:
> No objection to the functionality extension itself, but the
> implementatoin made me wonder why you had to implement convenience
> variable extension, and I went looking for what the equivalent CLI
> commands were doing. They are using get_number_or_range.
>
> Would it make sense, in this case, to extend the interface of
> those GDB/MI commands to match the interface of their CLI counterparts?
I thought about using get_number_or_range in MI parts too when I wrote
this patch. I didn't pursue this approach because of the different
error report in CLI and MI. Function get_number_trailer doesn't emit
any errors, and only returns 0 if something wrong. Callers of
get_number_or_range in CLI may emit warnings if 0 is returned. At
present, GDB MI emits error immediately when parsing is wrong.
> Depending on the answer, you might want to factorize a bit the code
> so that both use the same code (ie the CLI split the args first
> and then call the factorized function, while the MI would just call
> the factorized function). Otherwise, cli/cli-utils.c::get_number
> seems to be doing what you want.
I agree that we need some code factor here, so that both CLI and MI can
use the same interface. I'll post an updated patch.
--
Yao (éå)