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: Joel Brobecker <brobecker at adacore dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 19 Feb 2014 09:55:26 +0100
- 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>
> >> When I modify a MI test case to avoid hard code breakpoint number in
> >> the testcase, commands -break-passcount and -break-commands only
> >> accepts numbers and rejects convenience variables, such as $bpnum, as
> >> invalid input.
> >>
> >> IWBN to teach these commands to accept convenience variables, and
> >> avoid hard code breakpoint number in test case.
> >>
> >> I add a NEWS entry since it is user visible. However, I didn't update
> >> the manual because manual doesn't mention that commands 'enable' 'disable'
> >> accept convenience variable explicitly, likewise, doesn't mention this
> >> for MI commands. Some test cases are updated to replace hard code
> >> number with convenience variables.
> >>
> >> Regression tested on x86_64-linux.
> >>
> >> gdb:
> >>
> >> 2014-01-24 Yao Qi <yao@codesourcery.com>
> >>
> >> * mi/mi-cmd-break.c (parse_number): New function.
> >> (mi_cmd_break_passcount): Use parse_number instead of atoi.
> >> (mi_cmd_break_commands): Move some code to parse_number. Call
> >> parse_number.
> >> * NEWS: Mention that commands -break-passcount and
> >> -break-commands accept convenience variable.
> >>
> >> gdb/testsuite:
> >>
> >> 2014-01-24 Yao Qi <yao@codesourcery.com>
> >>
> >> * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify):
> >> Test command -break-passcount accepts convenience variable.
> >> * gdb.trace/mi-trace-frame-collected.exp: Test command
> >> -break-commands accepts convenience variable.
> >> * gdb.trace/mi-trace-unavailable.exp: Likewise.
> >
> > Ping. https://sourceware.org/ml/gdb-patches/2014-01/msg00936.html
> >
>
> Ping.
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?
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.
--
Joel