Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
	gdb-patches@sourceware.org
Subject: Re: [RFA 2/2] Modify gdb.base/commands.exp to test multi breakpoint command setting/clearing.
Date: Thu, 16 Aug 2018 15:54:00 -0000	[thread overview]
Message-ID: <73cfa6d6-b0e4-77bd-6221-bd824e03338a@redhat.com> (raw)
In-Reply-To: <20180802212613.29813-3-philippe.waroquiers@skynet.be>

Hi Philippe,

On 08/02/2018 10:26 PM, Philippe Waroquiers wrote:
> gdb/testsuite/ChangeLog
> 2018-08-02  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
> 
> 	* gdb.base/commands.exp: Test multi breakpoints setting
> 	and clearing.
> ---
>  gdb/testsuite/gdb.base/commands.exp | 44 +++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
> index 259b89b803..57d9348244 100644
> --- a/gdb/testsuite/gdb.base/commands.exp
> +++ b/gdb/testsuite/gdb.base/commands.exp
> @@ -281,6 +281,49 @@ proc_with_prefix breakpoint_command_test {} {
>      gdb_test "print value" " = 5"
>  }
>  
> +# Test clearing the commands of several breakpoints with one single "end".
> +# As this test uses breakpoint numbers, we better run it first to ensure
> +# the breakpoint numbers are not changing if other tests are added/changed
> +# so that breakpoint numbers are also changed.

The "are not changing" here gave me pause.  I think you meant "do not change".

I'd suggest:

 # Test clearing the commands of several breakpoints with one single "end".
 # As this test hardcodes breakpoint numbers, we better run it first to ensure
 # the breakpoint numbers remain stable, as other tests can also create
 # breakpoints.

But, I think you could simply remove this requirement.
You can for example get the first breakpoint number with:

    gdb_test "break factorial" "Breakpoint.*at.*"
    set bpnum [get_integer_valueof "\$bpnum" 0]

Or in a single shot:

        set bpnum 0
        gdb_test_multiple "break main" "set breakpoint on main" {
            -re "Breakpoint ($decimal) at .*$gdb_prompt $" {
                set bpnum $expect_out(1,string)
            }
        }

> +proc_with_prefix run_me_first_breakpoint_clear_command_test {} {
> +    # The below creates breakpoint nr 1.
> +    runto_or_return factorial
> +
> +    set any "\[^\r\n\]*"
> +    delete_breakpoints
> +    gdb_test "break factorial" "Breakpoint.*at.*"
> +    gdb_test "break main" "Breakpoint.*at.*"
> +    gdb_test \
> +	[multi_line_input \
> +	     {commands 2 3} \
> +	     {  print 1234321} \
> +	     {end}] \
> +	"End with.*" \
> +	"commands"
> +    gdb_test "info breakpoints" \
> +	[multi_line \
> +	     "${any}What${any}" \
> +	     "${any}in factorial${any}" \
> +	     "${any}print 1234321${any}" \
> +	     "${any}in main${any}" \
> +	     "${any}print 1234321${any}" \
> +	    ] \
> +	"check print 1234321 is there."

No period at end of test name.  While at it, "check" is redundant,
since all tests are checks.

> +    gdb_test \
> +	[multi_line_input \
> +	     {commands 2 3} \
> +	     {end}] \
> +	"End with.*" \
> +	"commands"
> +    gdb_test "info breakpoints" \
> +	[multi_line \
> +	     "${any}What${any}" \
> +	     "${any}in factorial${any}" \
> +	     "${any}in main${any}" \
> +	    ] \
> +	"check print 1234321 is not there anymore."

Ditto.

Also, you have a duplicated test name above: the "commands" tests:

 https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique

> +    }
> +
>  # Test a simple user defined command (with arguments)
>  proc_with_prefix user_defined_command_test {} {
>      global valnum_re
> @@ -1125,6 +1168,7 @@ proc_with_prefix backslash_in_multi_line_command_test {} {
>      gdb_test "print 1" "" "run command"
>  }
>  
> +run_me_first_breakpoint_clear_command_test
>  gdbvar_simple_if_test
>  gdbvar_simple_while_test
>  gdbvar_complex_if_while_test
> 

Thanks,
Pedro Alves


  reply	other threads:[~2018-08-16 15:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 21:26 RFA Fix regressions for multi breakpoints command line setting/clearing Philippe Waroquiers
2018-08-02 21:26 ` [RFA 2/2] Modify gdb.base/commands.exp to test multi breakpoint command setting/clearing Philippe Waroquiers
2018-08-16 15:54   ` Pedro Alves [this message]
2018-08-02 21:26 ` [RFA 1/2] Fix regressions for multi breakpoints command line setting/clearing Philippe Waroquiers
2018-08-03 18:29   ` Tom Tromey
2018-08-09  4:57     ` Tom Tromey
2018-08-09 20:20       ` Philippe Waroquiers
2018-08-10  0:35         ` Tom Tromey
2018-08-10  3:05           ` Tom Tromey
2018-08-10  3:13             ` Tom Tromey
2018-08-10 16:07               ` Tom Tromey
2018-08-11 20:38                 ` Tom Tromey
2018-08-13 21:32                   ` Philippe Waroquiers
2018-08-14 15:02               ` Pedro Alves
2018-08-14 18:33                 ` Tom Tromey
2018-08-15 18:24                   ` Tom Tromey
2018-08-16 15:34                     ` Pedro Alves
2018-08-17 23:12                       ` Tom Tromey
2018-08-21 18:01   ` Tom Tromey
2018-08-25 19:17     ` Philippe Waroquiers

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=73cfa6d6-b0e4-77bd-6221-bd824e03338a@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /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