Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Ulrich Weigand" <uweigand@de.ibm.com>, patches@linaro.org
Subject: Re: [rfc, gdbserver] Support hardware watchpoints on ARM
Date: Wed, 21 Sep 2011 13:46:00 -0000	[thread overview]
Message-ID: <201109211429.31335.pedro@codesourcery.com> (raw)
In-Reply-To: <201109121723.p8CHN03n017032@d06av02.portsmouth.uk.ibm.com>

Hi Ulrich,

I was just looking over the patch before lunch, and
meanwhile you've committed it.  :-)  It looks fine to me in any
case.  :-)  I just had a couple minor remarks.

On Monday 12 September 2011 18:23:00, Ulrich Weigand wrote:
> +  if (hwbp_type == arm_hwbp_break)
> +    {
> +      /* For breakpoints, the length field encodes the mode.  */
> +      switch (len)
> +       {
> +       case 2:  /* 16-bit Thumb mode breakpoint */
> +       case 3:  /* 32-bit Thumb mode breakpoint */
> +         mask = 0x3 << (addr & 2);
> +         break;
> +       case 4:  /* 32-bit ARM mode breakpoint */
> +         mask = 0xf;
> +         break;
> +       default:
> +         /* Unsupported. */
> +         return -1;
> +       }
> +
> +      addr &= ~3;

Is this ~3 correct for 16-bit Thumb?

> +    }


> +static void
> +arm_prepare_to_resume (struct lwp_info *lwp)
> +{
> +  int pid = lwpid_of (lwp);
> +  struct process_info *proc = find_process_pid (pid_of (lwp));
> +  struct arch_process_info *proc_info = proc->private->arch_private;
> +  struct arch_lwp_info *lwp_info = lwp->arch_private;
> +  int i;
> +
> +  for (i = 0; i < arm_linux_get_hw_breakpoint_count (); i++)

It's a bit unfortunate that arm_linux_get_hw_breakpoint_count 
relies on the current_inferior global having been set to LWP by
the callers.  We try to avoid that when we have an LWP handy.
Can we make arm_linux_get_hw_breakpoint_count take an LWP argument?

On Monday 12 September 2011 18:23:00, Ulrich Weigand wrote:
> +       if (arm_hwbp_control_is_enabled (proc_info->bpts[i].control))
> +         if (ptrace (PTRACE_SETHBPREGS, pid, ((i << 1) + 1),
> +             &proc_info->bpts[i].address) < 0)
> +           error (_("Unexpected error setting breakpoint address"));
> +
> +       if (arm_hwbp_control_is_initialized (proc_info->bpts[i].control))
> +         if (ptrace (PTRACE_SETHBPREGS, pid, ((i << 1) + 2),
> +             &proc_info->bpts[i].control) < 0)
> +           error (_("Unexpected error setting breakpoint"));

I think perror_with_name would be better, so we can see on the logs
the errno ptrace set on error.

-- 
Pedro Alves


  parent reply	other threads:[~2011-09-21 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-12 18:09 Ulrich Weigand
2011-09-21 13:29 ` Ulrich Weigand
2011-09-21 13:46 ` Pedro Alves [this message]
2011-09-21 14:20   ` Ulrich Weigand
2011-09-21 14:26     ` Pedro Alves
2011-09-21 14:29       ` Ulrich Weigand
2011-09-21 14:34         ` Pedro Alves
2011-09-21 16:20           ` [commit] " Ulrich Weigand
2011-09-21 16:23             ` 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=201109211429.31335.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patches@linaro.org \
    --cc=uweigand@de.ibm.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