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: ping: [PATCH] Accept convenience variable in commands -break-passcount and -break-commands


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


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