From: Pedro Alves <pedro@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix linux-ia64 on SIGILL for deleted breakpoint
Date: Sat, 24 Jul 2010 22:26:00 -0000 [thread overview]
Message-ID: <201007242326.05269.pedro@codesourcery.com> (raw)
In-Reply-To: <20100723221935.GA7020@host1.dyn.jankratochvil.net>
On Friday 23 July 2010 23:19:35, Jan Kratochvil wrote:
> This SIGTRAP->SIGILL case happens only on ia64 and ia64 does not use any
> set_gdbarch_decr_pc_after_break at all, PC stays on the breakpoint bundle+slot
> in both the SIGTRAP and SIGILL case.
>
> You are right it is arch-specific. On i386 I checked SIGILL is never
> generated (only in some fpu-emulated code). So I checked s390x-linux-gnu::
> SIGILL on opcode 0xb29e
> si_addr = 0x800009a4
> .psw.addr = 0x800009a8
> instr at = 0x800009a4
> .psw.addr - instr == 4
Oh? Does this mean the PC is left pointing _after_ the instruction
that caused the SIGILL?
I think you still need to audit other bits in linux-nat.c for SIGTRAP bkpts
handling. E.g., see stop_wait_callback. (For extra correctness,
count_events_callback, and the select_event_lwp_callback functions would
be relaxed too.) I wasn't previously suggesting to make this ia64 arch
specific, which made fixing these other places too easier. Notice how
gdbserver/linux-low.c also considers non-sigtrap bkpts (and it was a recent
change, needed for ARM thumb2 kernels that hadn't learned about the
breakpoint insns yet, IIRC).
> --- a/gdb/ia64-linux-nat.c
> +++ b/gdb/ia64-linux-nat.c
> @@ -809,6 +809,26 @@ ia64_linux_xfer_partial (struct target_ops *ops,
> offset, len);
> }
>
> +/* For break.b instruction ia64 CPU forgets the immediate value and generates
> + SIGILL with ILL_ILLOPC instead of more common SIGTRAP with TRAP_BRKPT. */
> +
> +static int
> +ia64_linux_cancel_breakpoint (struct lwp_info *lp)
> +{
> + /* We check for lp->waitstatus in addition to lp->status, because we can
> + have pending process exits recorded in lp->status
> + and W_EXITCODE(0,0) == 0. We should probably have an additional
> + lp->status_p flag. */
> +
> + if (! (lp->waitstatus.kind == TARGET_WAITKIND_IGNORE
> + && WIFSTOPPED (lp->status)
> + && (WSTOPSIG (lp->status) == SIGTRAP
> + || WSTOPSIG (lp->status) == SIGILL)))
> + return 0;
> +
> + return linux_nat_cancel_breakpoint_when_signalled (lp);
If this stays, please add a comment above this call mentioning that
we can safely call this function even for SIGILL, since
decr_pc_after_break is 0 on ia64. (Alternatively, recode to avoid
the assumption) The point I'm making is that PC adjustment is
always only necessary for sigtraps, never other signals (and is in fact
wrong for other signals).
--
Pedro Alves
next prev parent reply other threads:[~2010-07-24 22:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-19 8:58 Jan Kratochvil
2010-07-19 9:04 ` Tristan Gingold
2010-07-19 9:20 ` Jan Kratochvil
2010-07-19 9:50 ` Tristan Gingold
2010-07-20 13:29 ` Pedro Alves
2010-07-23 22:19 ` Jan Kratochvil
2010-07-24 22:26 ` Pedro Alves [this message]
2010-07-25 18:52 ` Jan Kratochvil
2010-07-25 18:55 ` [patch] Fix linux-ia64 on SIGILL for deleted breakpoint [cleanup] Jan Kratochvil
2010-07-27 11:59 ` Pedro Alves
2010-07-27 21:22 ` Jan Kratochvil
2010-07-27 11:43 ` [patch] Fix linux-ia64 on SIGILL for deleted breakpoint Pedro Alves
2010-07-27 20:55 ` Jan Kratochvil
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=201007242326.05269.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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