Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Aktemur, Baris" <TankutBaris.Aktemur@amd.com>
To: Klaus Gerlicher <klaus.gerlicher@intel.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: "aburgess@redhat.com" <aburgess@redhat.com>,
	"simark@simark.ca" <simark@simark.ca>
Subject: RE: [PATCH v5 1/1] gdb: avoid conversion of SIGSEGV to SIGTRAP on user breakpoints
Date: Tue, 1 Sep 2026 07:02:51 +0000	[thread overview]
Message-ID: <DM4PR12MB64709BD3E641BB0519649564F8A82@DM4PR12MB6470.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20260828125003.253648-1-klaus.gerlicher@intel.com>

AMD General

On Friday, August 28, 2026 3:50 PM, Klaus Gerlicher wrote:
> From: "Gerlicher, Klaus" <klaus.gerlicher@intel.com>
>
> GDB converts signals GDB_SIGNAL_ILL, GDB_SIGNAL_SEGV and GDB_SIGNAL_EMT to
> GDB_SIGNAL_TRAP if a breakpoint is inserted at the fault location.  This
> conversion logic assumes that when these signals occur at a breakpoint
> location, the signal was actually caused by hitting the breakpoint rather
> than a genuine fault.
>
> However, some architectures have "imprecise page fault reporting," where a
> memory access violation can be reported several instructions after the
> faulting instruction.  For example:
>
>   INSN1  <-- generates a SIGSEGV
>   INSN2
>   INSN3  <-- breakpoint installed here
>
> If INSN1 causes a memory access violation, the backend may report the stop
> at INSN3, where a breakpoint happens to be installed.  GDB's logic then
> incorrectly assumes "there is a breakpoint at INSN3, so this SIGSEGV must
> mean we hit the breakpoint" and converts it to SIGTRAP.  On architectures
> with imprecise fault reporting, this is wrong: if a breakpoint is never
> reported via SIGSEGV, then receiving a SIGSEGV at a breakpoint location
> means we have a genuine SIGSEGV, not a breakpoint hit.
>
> Add a new gdbarch function, imprecise_pagefault_reporting, that allows the
> signal conversion from GDB_SIGNAL_SEGV to GDB_SIGNAL_TRAP to be skipped for
> an architecture.  The default is false (conversion enabled), preserving
> existing behavior.  Architectures with imprecise fault reporting should
> override this to return true.

Looks good to me.  Thanks.

Reviewed-By: Tankut Baris Aktemur <TankutBaris.Aktemur@amd.com>

When this is merged, I'll submit a patch that overrides the gdbarch method
in the amdgpu target and includes a test.

-Baris



  reply	other threads:[~2026-09-01  7:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 12:50 Klaus Gerlicher
2026-09-01  7:02 ` Aktemur, Baris [this message]
2026-09-02 19:20 ` Tom Tromey
2026-09-15 18:31   ` Simon Marchi

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=DM4PR12MB64709BD3E641BB0519649564F8A82@DM4PR12MB6470.namprd12.prod.outlook.com \
    --to=tankutbaris.aktemur@amd.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=klaus.gerlicher@intel.com \
    --cc=simark@simark.ca \
    /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