Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, Klaus Gerlicher <klaus.gerlicher@intel.com>
Cc: gdb-patches@sourceware.org, TankutBaris.Aktemur@amd.com,
	aburgess@redhat.com
Subject: Re: [PATCH v5 1/1] gdb: avoid conversion of SIGSEGV to SIGTRAP on user breakpoints
Date: Tue, 15 Sep 2026 14:31:35 -0400	[thread overview]
Message-ID: <758947b4-77f5-47c6-a4c6-16e77f23e21b@simark.ca> (raw)
In-Reply-To: <87qzjb4fzo.fsf@tromey.com>



On 2026-09-02 15:20, Tom Tromey wrote:
>>>>>> Klaus Gerlicher <klaus.gerlicher@intel.com> writes:
> 
>> 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.
> 
> Thanks for the patch.
> 
>> 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.
> 
> My first thought was that, without an implementation in the tree, this
> will cause gdb/check-gdbarch.py to complain.  However, I saw that the
> plan is a follow-up patch to use this.
> 
> Maybe temporarily marking this 'unused' would be good, provided that is
> removed in the follow-up.
> 
> Also I was wondering, why a Function and not a Value?
> 
>> +    predefault="[] () -> bool {return false;}",
> 
> This doesn't take arguments, so presumably just a value would be
> sufficient?

Yeah if it can be a value, let's make it a value.

My only comment would be that here:

  if (ecs->ws.kind () == TARGET_WAITKIND_STOPPED
      && (ecs->ws.sig () == GDB_SIGNAL_ILL
	  || (ecs->ws.sig () == GDB_SIGNAL_SEGV
	      && !gdbarch_imprecise_pagefault_reporting
		  (target_thread_architecture (ecs->event_thread->ptid)))
	  || ecs->ws.sig () == GDB_SIGNAL_EMT))

You would need some extra parentheses to make emacs happy:

  if (ecs->ws.kind () == TARGET_WAITKIND_STOPPED
      && (ecs->ws.sig () == GDB_SIGNAL_ILL
	  || (ecs->ws.sig () == GDB_SIGNAL_SEGV
	      && !(gdbarch_imprecise_pagefault_reporting
		   (target_thread_architecture (ecs->event_thread->ptid))))
	  || ecs->ws.sig () == GDB_SIGNAL_EMT))

With that and Tom's two suggestions (make it a value and temporarily
mark unused), the patch LGTM.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

      reply	other threads:[~2026-09-15 18:32 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
2026-09-02 19:20 ` Tom Tromey
2026-09-15 18:31   ` Simon Marchi [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=758947b4-77f5-47c6-a4c6-16e77f23e21b@simark.ca \
    --to=simark@simark.ca \
    --cc=TankutBaris.Aktemur@amd.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=klaus.gerlicher@intel.com \
    --cc=tom@tromey.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