All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>,
	"Maciej W. Rozycki" <macro@imgtec.com>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	gdb-patches@sourceware.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Expect SI_KERNEL si_code for a MIPS software breakpoint trap
Date: Tue, 16 Feb 2016 00:57:35 +0000	[thread overview]
Message-ID: <56C273FF.7070206@redhat.com> (raw)
In-Reply-To: <56BB329F.3080606@codesourcery.com>

On 02/10/2016 12:52 PM, Luis Machado wrote:
> The problem of forcing gdbserver to recognize all traps with 
> si_code==SI_KERNEL is that even hardcoded traps will be reported back to 
> GDB as a swbreak event, which is not ideal.

That's how swbreak is defined:

 @item swbreak
 @anchor{swbreak stop reason}
 The packet indicates a memory breakpoint instruction was executed,
 irrespective of whether it was @value{GDBN} that planted the
 breakpoint or the breakpoint is hardcoded in the program.

> 
> But currently there is no easy way to tell a software breakpoint hit and 
> a hardcoded trap (and maybe even a hardware breakpoint hit?) apart.

Software breakpoint hits or hardcoded traps are handled the same.  Even if GDB
plants the breakpoint instruction itself with direct memory pokes (instead of
z0 packets), the target should report "swbreak" stops, so that gdb can do
the right thing.

GDB knows whether to discard the hit as a delayed breakpoint hit event by
checking whether the thread's PC points at an hardcoded trap.  If it does,
the event is not discarded, but instead reported to the user as a SIGTRAP.

Hardware breakpoint hits are distinguished from software breakpoint hits,
because they're reported with "hwbreak", not "swbreak":

 @item hwbreak
 The packet indicates the target stopped for a hardware breakpoint.
 The @var{r} part must be left empty.

Thanks,
Pedro Alves

      parent reply	other threads:[~2016-02-16  0:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1442592647-3051-1-git-send-email-lgustavo@codesourcery.com>
2015-09-18 16:56 ` [PATCH] Expect SI_KERNEL si_code for a MIPS software breakpoint trap Maciej W. Rozycki
2015-09-18 17:04   ` David Daney
2015-09-18 18:36     ` Maciej W. Rozycki
2016-02-09 14:29   ` Luis Machado
2016-02-09 14:29     ` Luis Machado
2016-02-09 20:55     ` Maciej W. Rozycki
2016-02-09 20:55       ` Maciej W. Rozycki
2016-02-10 12:52       ` Luis Machado
2016-02-10 12:52         ` Luis Machado
2016-02-15 23:50         ` Maciej W. Rozycki
2016-02-15 23:50           ` Maciej W. Rozycki
2016-02-16  0:30           ` Pedro Alves
2016-02-19 16:21             ` Maciej W. Rozycki
2016-02-19 16:21               ` Maciej W. Rozycki
2016-02-24 11:52               ` Pedro Alves
2016-02-16  0:57         ` Pedro Alves [this message]

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=56C273FF.7070206@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@imgtec.com \
    --cc=macro@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.