public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/testsuite: Run test when software watchpoints are used
Date: Sat, 07 Jul 2018 00:47:00 -0000	[thread overview]
Message-ID: <d411f18f-5d7f-9174-65ce-c94762e575c1@simark.ca> (raw)
In-Reply-To: <20180706232109.GR2675@embecosm.com>

On 2018-07-06 07:21 PM, Andrew Burgess wrote:
> OK, got you, something like this then:

Yes, that looks good.  However, the test doesn't really work for me here,
even without this patch, I get a ton of failures.  Does it work well for you
on native x86_64?  If so, I'm fine if you push the patch.  Finding it why it
fails on my machine is another story.  Here's the gdb.log, for reference.

https://pastebin.com/raw/izy5c0Eh

I just noted two nits:

> @@ -183,9 +186,10 @@ proc valid_addr_p {cmd offset width} {
>  }
>  
>  # Watch WIDTH bytes at BASE + OFFSET.  CMD specifices the specific
> -# type of watchpoint to use.  If CMD is "hbreak", WIDTH is ignored.
> +# type of watchpoint to use.  If CMD is "hbreak", WIDTH is ignored.  The
> +# HW_WP_P flag tells us if harware watchpoints are enabled or not.

"harware"

> @@ -249,3 +266,22 @@ foreach always_inserted {"off" "on" } {
>  	}
>      }
>  }
> +
> +# Run tests with hardware watchpoints disabled, then again with them
> +# enabled (if this target supports hardware watchpoints).
> +foreach hw_wp_p { 0 1 } {
> +
> +    if { $hw_wp_p } {
> +	# Does this target support h/w watchpoints?
> +	if [target_info exists gdb,no_hardware_watchpoints] { continue }
> +	set prefix "hw-watch"
> +    } else {
> +	set prefix "sw-watch"
> +    }
> +
> +    gdb_test_no_output "set can-use-hw-watchpoints ${hw_wp_p}"
> +
> +    with_test_prefix $prefix {
> +	run_watchpoints_tests $hw_wp_p
> +    }
> +}

For just two variations, I am not sure we gain much in readability by doing a loop
here.  It might be clearer to do:

run_tests_software_watchpoints

if supports_hardware_watchpoints:
  run_tests_hardware_watchpoints


I don't really mind, it's your choice.

Simon

  reply	other threads:[~2018-07-07  0:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 16:40 Andrew Burgess
2018-07-06  2:53 ` Simon Marchi
2018-07-06 13:59   ` Andrew Burgess
2018-07-06 14:43     ` Simon Marchi
2018-07-06 23:21       ` Andrew Burgess
2018-07-07  0:47         ` Simon Marchi [this message]
2018-07-10 14:01           ` Andrew Burgess
2018-10-31 13:52             ` Phil Muldoon

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=d411f18f-5d7f-9174-65ce-c94762e575c1@simark.ca \
    --to=simark@simark.ca \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).