From: Joel Brobecker <brobecker@adacore.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/4] Error on bad count number
Date: Wed, 05 Mar 2014 14:29:00 -0000 [thread overview]
Message-ID: <20140305142939.GB16858@adacore.com> (raw)
In-Reply-To: <1394023608-10761-3-git-send-email-yao@codesourcery.com>
> GDB is quiet for these invalid input like this
>
> (gdb) enable count 1.1 1
> (gdb)
>
> This patch is to check the input number is valid, and emit error if
> input number isn't valid. With this patch, it becomes:
>
> (gdb) enable count 1.1 1
> Bad count number '1.1 1'
>
> gdb:
>
> 2014-03-05 Yao Qi <yao@codesourcery.com>
>
> * breakpoint.c (enable_count_command): Emit error if 'count'
> is zero.
>
> gdb/testsuite:
>
> 2014-03-05 Yao Qi <yao@codesourcery.com>
>
> * gdb.base/ena-dis-br.exp: Test bad count number.
I had a slight hesitation here, as we are now going to actively
reject "enable count 0 1" where it used to be accepted. But since
it makes little sense, and does not work, I think that's OK.
Example of it not working:
(gdb) b a
Breakpoint 1 at 0x401558: file a.adb, line 3.
(gdb) enable count 0 1
(gdb) run
Starting program: /[...]/a
Breakpoint 1, a () at a.adb:3
3 raise Constraint_Error;
The good news is that the breakpoint gets disabled afterwards,
so it's not completely broken:
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint dis n 0x0000000000401558 in a at a.adb:3
breakpoint already hit 1 time
> + if (count == 0)
> + error (_("Bad count number '%s'"), p);
I would change it to "Invalid count number" instead.
> +
> map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
> }
>
> diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
> index 6f2c469..4b83e56 100644
> --- a/gdb/testsuite/gdb.base/ena-dis-br.exp
> +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
> @@ -169,6 +169,11 @@ gdb_test "continue" \
> ".*marker1 .*:($bp_location15|$bp_location16).*" \
> "continue through enable count, now disabled"
>
> +# Test enable count with bad count number.
> +
> +gdb_test "enable count 1.1 $bp" "Bad count number '1.1 $bp'.*" \
> + "enable count with bad number"
Can you also add a test for '0' as the count number?
> # Verify that we can set a breakpoint with an ignore count N, which
> # should cause the next N triggers of the bp to be ignored. (This is
> # a flavor of enablement/disablement, after all.)
Thank you,
--
Joel
next prev parent reply other threads:[~2014-03-05 14:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 12:49 [PATCH 0/4] Tweak get_number related code Yao Qi
2014-03-05 12:49 ` [PATCH 4/4] Remove argument optional_p from get_tracepoint_by_number Yao Qi
2014-03-05 14:44 ` Joel Brobecker
2014-03-05 12:49 ` [PATCH 3/4] Handle parse number error in goto_bookmark_command Yao Qi
2014-03-05 14:38 ` Joel Brobecker
2014-03-06 7:10 ` Yao Qi
2014-03-05 12:49 ` [PATCH 2/4] Error on bad count number Yao Qi
2014-03-05 14:29 ` Joel Brobecker [this message]
2014-03-05 15:59 ` Pedro Alves
2014-03-06 9:56 ` Yao Qi
2014-03-06 12:21 ` Pedro Alves
2014-03-06 13:24 ` Joel Brobecker
2014-03-07 9:40 ` Yao Qi
2014-03-07 10:53 ` Eli Zaretskii
2014-03-07 11:09 ` Yao Qi
2014-03-07 13:27 ` Pedro Alves
2014-03-07 13:50 ` Joel Brobecker
2014-03-10 2:01 ` Yao Qi
2014-03-06 13:26 ` Joel Brobecker
2014-03-05 12:49 ` [OBV PATCH 1/4] Add a newline in output messages Yao Qi
2014-03-05 14:22 ` Joel Brobecker
2014-03-06 6:45 ` 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=20140305142939.GB16858@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--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