This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] GDB patches for hw watchpoints

On Wed, Aug 17, 2005 at 12:27:46PM -0500, Manoj Iyer wrote:
> I am submitting this patch on behalf of  Ben Elliston <>,
> this patch implements hardware watchpoints on PPC platform. Please review
> and comment, so I can commit.
> 2005-05-04  Ben Elliston  <>
>         * config/powerpc/nm-linux.h
>         (STOPPED_BY_WATCHPOINT): Likewise.
>         (target_insert_watchpoint): Likewise.
>         (target_remove_watchpoint): Likewise.
>         (ppc_linux_insert_watchpoint): Declare.
>         (ppc_linux_remove_watchpoint): Likewise.
>         * ppc-linux-nat.c (PTRACE_GET_DEBUGREG): Define, if not already.
>         (PTRACE_SET_DEBUGREG): Likewise.
>         (PTRACE_GETSINGOINFO): Likewise.
>         (ppc_linux_insert_watchpoint): New.
>         (ppc_linux_remove_watchpoint): Likewise.
>         (ppc_linux_stopped_by_watchpoint): Likewise.
>         (ppc_linux_check_watch_resources): Likewise.

Mark raised a valid concern about the use of the NM file for this;
the problem has now been fixed, so you can do this without touching

Eli asked a valid question about how the entire process works.

Also, I had trouble believing that this interface was sufficiently
portable among the many PowerPC variants (which have at least two
different debug register schemes), so I went and checked.  Support for
these ptrace operations is not in the kernel.  Where is it,
and how's it supposed to work?

> +  errno = 0;
> +  ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_TYPE_ARG3) 0, &siginfo);
> +
> +  if (errno != 0 || siginfo.si_signo != SIGTRAP ||
> +      (siginfo.si_code & 0xffff) != 0x0004)
> +    return 0;

Hmm, if you're using siginfos for this, then at least some PPCs ought to
be able to tell you where the fault occured.

> +int
> +ppc_linux_check_watch_resources (int type, int cnt, int ot)
> +{
> +  /* PPC has one DABR (hardware watchpoint) register.  */
> +  return (cnt <= 1);
> +}

Some have none.  I don't know what other variations there may be.

Daniel Jacobowitz
CodeSourcery, LLC

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]