This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH, v3] Expect SI_KERNEL or TRAP_BRKPT si_code values for MIPS breakpoint traps
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>
- Cc: Pedro Alves <palves at redhat dot com>, <gdb-patches at sourceware dot org>
- Date: Tue, 23 Feb 2016 00:01:38 +0000
- Subject: Re: [PATCH, v3] Expect SI_KERNEL or TRAP_BRKPT si_code values for MIPS breakpoint traps
- Authentication-results: sourceware.org; auth=none
- References: <1456179628-14249-1-git-send-email-lgustavo at codesourcery dot com> <56CB8E9D dot 70605 at redhat dot com> <56CB9042 dot 8090809 at codesourcery dot com>
On Mon, 22 Feb 2016, Luis Machado wrote:
> > > + 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.
> >
> > Also, "and SIGTRAP's in general." seems wrong. I hope that that's
> > not the case for user-sent SIGTRAPs?
>
> I'll defer that to Maciej, as he knows what the kernel emits here. From his
> descriptions, it seems MIPS' kernel pretty much just uses the default si_code
> of SI_KERNEL.
Yes, for signals produced by the kernel itself, i.e. with `__send_signal'
from kernel/signal.c with the `info' argument set to SEND_SIG_PRIV, which
the various calls to `force_sig' from arch/mips/kernel/traps.c boil down
to. To have the code set to something else `force_sig_info' is used, in
the interpretation of `BREAK 6' and `BREAK 7' instructions among other
cases. This is also how kill(2) works, setting the code to SI_USER for
user-issued signals, which is generic in Linux so any architecture will do
the same here.
Maciej