Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: Doug Evans <xdje42@gmail.com>,
	       "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] x86 Linux watchpoints: Couldn't write debug register: Invalid, argument.
Date: Sun, 22 Jun 2014 18:31:00 -0000	[thread overview]
Message-ID: <20140622183110.GA25638@host2.jankratochvil.net> (raw)
In-Reply-To: <53A46706.8010601@redhat.com>

On Fri, 20 Jun 2014 18:53:26 +0200, Pedro Alves wrote:
> I could reproduce this with 7.7, even.
> 
> This is not a 7.8 regression, but I think it can go in safely to the branch.

While I agree it still is a testsuite results regression.


[...]
> --- a/gdb/nat/i386-dregs.c
> +++ b/gdb/nat/i386-dregs.c
> @@ -141,6 +141,13 @@
>        (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
>    } while (0)
>  
> +/* Locally disable the break/watchpoint in the I'th debug register.  */
> +#define I386_DR_LOCAL_DISABLE(state, i) \
> +  do { \
> +    (state)->dr_control_mirror &= \
> +     ~(1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
> +  } while (0)
> +
>  /* Globally enable the break/watchpoint in the I'th debug register.  */
>  #define I386_DR_GLOBAL_ENABLE(state, i) \
>    do { \
> @@ -348,6 +355,7 @@ i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
>  				CORE_ADDR addr, unsigned len_rw_bits)
>  {
>    int i, retval = -1;
> +  int all_vacant = 1;
>  
>    ALL_DEBUG_REGISTERS (i)
>      {
> @@ -360,11 +368,31 @@ i386_remove_aligned_watchpoint (struct i386_debug_reg_state *state,
>  	      /* Reset our mirror.  */
>  	      state->dr_mirror[i] = 0;
>  	      I386_DR_DISABLE (state, i);
> +	      /* Even though not strictly necessary, clear out all
> +		 bits in DR_CONTROL related to this debug register.
> +		 Debug output is clearer when we don't have stale bits
> +		 in place.  This also allows the assertion below.  */
> +	      I386_DR_LOCAL_DISABLE (state, i);

This is redundant, I386_DR_DISABLE already does both GLOBAL_DISABLE-like and
LOCAL_DISABLE-like.


> +	      I386_DR_SET_RW_LEN (state, i, 0);
>  	    }
>  	  retval = 0;
>  	}
> +
> +      if (!I386_DR_VACANT (state, i))
> +	all_vacant = 0;
>      }
>  
> +  if (all_vacant)
> +    {
> +      /* Even though not strictly necessary, clear out all of
> +	 DR_CONTROL, so that when we have no debug registers in use,
> +	 we end up with DR_CONTROL == 0.  The Linux support relies on
> +	 this for an optimization.  Plus, it makes for clearer debug
> +	 output.  */
> +      state->dr_control_mirror &= ~DR_LOCAL_SLOWDOWN;
> +
> +      gdb_assert (state->dr_control_mirror == 0);
> +    }
>    return retval;
>  }
>  
[...]


Thanks,
Jan


  parent reply	other threads:[~2014-06-22 18:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07  1:10 [PATCH v3 0/5] Fix lost events, and handle multiple step-overs Pedro Alves
2014-03-07  1:10 ` [PATCH v3 5/5] Make signal-while-stepping-over-bp-other-thread.exp run against remote targets too Pedro Alves
2014-03-07  1:10 ` [PATCH v3 2/5] PR breakpoints/7143 - Watchpoint does not trigger when first set Pedro Alves
2014-03-16  3:41   ` Doug Evans
2014-03-17 17:11     ` Pedro Alves
2014-03-19 16:52       ` Doug Evans
2014-03-20 13:58         ` Pedro Alves
2014-03-20 13:57       ` Pedro Alves
2014-06-17 19:18         ` Regression for watchpoint-fork.exp [Re: [PATCH v3 2/5] PR breakpoints/7143 - Watchpoint does not trigger when first set] Jan Kratochvil
2014-06-18 10:43           ` Pedro Alves
2014-06-19 13:43           ` Jan Kratochvil
2014-06-19 15:02             ` Pedro Alves
2014-06-19 16:56               ` Pedro Alves
2014-06-19 17:00                 ` Jan Kratochvil
2014-06-20 16:53                   ` [PATCH] x86 Linux watchpoints: Couldn't write debug register: Invalid, argument Pedro Alves
2014-06-20 17:45                     ` Tom Tromey
2014-06-20 17:52                       ` Pedro Alves
2014-06-20 17:53                         ` Tom Tromey
2014-06-22 18:31                     ` Jan Kratochvil [this message]
2014-06-23 17:41                       ` Pedro Alves
2014-06-23 17:44                         ` Pedro Alves
2014-03-07  1:10 ` [PATCH v3 4/5] Handle multiple step-overs Pedro Alves
2014-03-07  1:10 ` [PATCH v3 3/5] Fix for even more missed events; eliminate thread-hop code Pedro Alves
2014-03-07  1:10 ` [PATCH v3 1/5] Fix missing breakpoint/watchpoint hits, eliminate deferred_step_ptid Pedro Alves
2014-03-20 13:59 ` [PUSHED] Re: [PATCH v3 0/5] Fix lost events, and handle multiple step-overs Pedro Alves

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=20140622183110.GA25638@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=xdje42@gmail.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