public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@imgtec.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>, "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: [PATCH] Handle MIPS Linux SIGTRAP siginfo.si_code values
Date: Wed, 24 Feb 2016 18:29:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.00.1602241821220.15885@tp.orcam.me.uk> (raw)
In-Reply-To: <1456332239-24007-1-git-send-email-palves@redhat.com>

On Wed, 24 Feb 2016, Pedro Alves wrote:

> @@ -140,14 +140,32 @@ struct buffer;
>     in SPU code on a Cell/B.E.  However, SI_KERNEL is never seen
>     on a SIGTRAP for any other reason.
>  
> -   The generic Linux target code should use GDB_ARCH_IS_TRAP_BRKPT
> -   instead of TRAP_BRKPT to abstract out these peculiarities.  */
> +   The MIPS kernel uses SI_KERNEL for all kernel generated traps.
> +   Since:
> +
> +     - MIPS doesn't do hardware single-step
> +     - We don't need to care about exec SIGTRAPs, since we assume
> +       PTRACE_EVENT_EXEC.
> +     - The MIPS kernel doesn't support hardware breakpoints.
> +
> +   on MIPS, all we need to care about is distinguishing between
> +   software breakpoints and hardware watchpoints, which can be done by
> +   peeking the debug registers.

 I'm assuming spurious traps such as from trap instructions will still be 
delivered as such, right?

> +
> +   The generic Linux target code should use GDB_ARCH_IS_TRAP_* instead
> +   of TRAP_* to abstract out these peculiarities.  */
>  #if defined __i386__ || defined __x86_64__
>  # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL)
> +# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
>  #elif defined __powerpc__
>  # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
> +# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
> +#elif defined __mips__
> +# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL)
> +# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == SI_KERNEL)

 Shall I add the TRAP_BRKPT and TRAP_HWBKPT codes to the MIPS Linux kernel 
then or not?  If anything, this looks like a performance win to me, at no 
significant cost (any possible kernel overhead will be in the range of a 
couple processor instructions, which is nothing compared to an extra 
ptrace(2) call and all the associated processing).

  Maciej

  reply	other threads:[~2016-02-24 18:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 16:44 Pedro Alves
2016-02-24 18:29 ` Maciej W. Rozycki [this message]
2016-02-24 18:51   ` Pedro Alves
2016-02-24 19:02     ` Luis Machado
2016-02-24 20:49       ` Maciej W. Rozycki
2016-02-24 21:10         ` Luis Machado
2016-02-24 20:39     ` Maciej W. Rozycki
2016-02-24 23:20       ` Pedro Alves
2016-02-24 23:37         ` [PATCH] MIPS/Linux: Also recognize TRAP_BRKPT and TRAP_HWBKPT Pedro Alves
2016-02-25  1:39         ` [PATCH] Handle MIPS Linux SIGTRAP siginfo.si_code values Maciej W. Rozycki
2016-02-25  1:45           ` Pedro Alves
2016-04-05 16:57             ` Maciej W. Rozycki
2016-04-15 23:17               ` Pedro Alves
2016-02-24 18:51 ` Luis Machado

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=alpine.DEB.2.00.1602241821220.15885@tp.orcam.me.uk \
    --to=macro@imgtec.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@linux-mips.org \
    --cc=palves@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).