From: Pedro Alves <palves@redhat.com>
To: Luis Machado <lgustavo@codesourcery.com>, gdb-patches@sourceware.org
Cc: macro@linux-mips.org
Subject: Re: [PATCH, v3] Expect SI_KERNEL or TRAP_BRKPT si_code values for MIPS breakpoint traps
Date: Wed, 24 Feb 2016 12:55:00 -0000 [thread overview]
Message-ID: <56CDA835.7030903@redhat.com> (raw)
In-Reply-To: <56CBBD44.8020808@codesourcery.com>
On 02/23/2016 02:00 AM, Luis Machado wrote:
> On 02/22/2016 07:41 PM, Pedro Alves wrote:
>> On 02/22/2016 10:20 PM, Luis Machado wrote:
>>
>>> diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
>>> index ba58717..72b32b1 100644
>>> --- a/gdb/nat/linux-ptrace.h
>>> +++ b/gdb/nat/linux-ptrace.h
>>> @@ -140,11 +140,16 @@ struct buffer;
>>> in SPU code on a Cell/B.E. However, SI_KERNEL is never seen
>>> on a SIGTRAP for any other reason.
>>>
>>> + The MIPS kernel uses the default si_code of SI_KERNEL for software
>>> + breakpoints, hardware watchpoints and SIGTRAP's in general.
>>
>> If we get this for both software breakpoints and hardware watchpoints,
>> then it seems to me that this change still leaves watchpoints broken,
>> as I can't see how check_stopped_by_watchpoint is reached, in either
>> gdb/linux-nat.c or gdbserver/linux-low.c.
>
> With or without this specific breakpoint fix, hardware watchpoints are
> already broken for MIPS AFAICS.
Yep, hence my "still". ;-)
>
> MIPS' kernel has never set si_code to anything other than SI_KERNEL.
> When the change to expect TRAP_HWBKPT was committed, then hardware
> watchpoints stopped working properly for MIPS.
>
> Now all hardware watchpoints produce are breakpoint-like traps that get
> silently ignored by GDB as "delayed software breakpoint trap". Neither
> GDB nor GDBserver can tell when a hardware watchpoint really happened by
> using si_code information.
>
> But this seems to be a different issue and i think it should be handle
> separately.
I think it's all the same, and that we'll need to change
linux-nat.c:save_sigtrap and the equivalent bits in gdbserver/linux-low.c.
So if we pick the table I added for x86, and fill it in
for MIPS, this is what we get:
| what | si_code |
|------------------------------------------+----------------|
| software breakpoints | SI_KERNEL |
| single-steps | N/A |
| single-stepping a syscall | N/A |
| user sent SIGTRAP | 0 |
| exec SIGTRAP (when no PTRACE_EVENT_EXEC) | doesn't matter |
| hardware breakpoints | N/A |
| hardware watchpoints | SI_KERNEL |
So the only distinction we need to make is between software
breakpoints SI_KERNEL, and hardware watchpoints SI_KERNEL.
And we can accurately do that with
mips_linux_stopped_by_watchpoint / mips_stopped_by_watchpoint.
Is my understanding correct?
Thanks,
Pedro Alves
next prev parent reply other threads:[~2016-02-24 12:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 22:20 Luis Machado
2016-02-22 22:41 ` Pedro Alves
2016-02-22 22:48 ` Luis Machado
2016-02-23 0:01 ` Maciej W. Rozycki
2016-02-23 2:00 ` Luis Machado
2016-02-23 21:09 ` Maciej W. Rozycki
2016-02-24 12:55 ` Pedro Alves [this message]
2016-02-24 13:21 ` Luis Machado
2016-02-24 14:44 ` Pedro Alves
2016-02-24 16:46 ` 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=56CDA835.7030903@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox