RE: [PATCH v4 1/1] gdb: avoid conversion of SIGSEGV to SIGTRAP on user breakpoints
"Gerlicher, Klaus" <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <DM3PPFD7E67F03693672C3527F9BF86C849E8C62@DM3PPFD7E67F036.namprd11.prod.outlook.com> |
Thank you, Baris. I discovered this too *after* I posted. I'll make sure it's updated once Andrew approves again. Thanks Klaus > -----Original Message----- > From: Aktemur, Baris <[email protected]> > Sent: Friday, July 17, 2026 11:17 AM > To: Gerlicher, Klaus <[email protected]>; gdb- > [email protected] > Cc: [email protected] > Subject: RE: [PATCH v4 1/1] gdb: avoid conversion of SIGSEGV to SIGTRAP on > user breakpoints > > AMD General > > Hi Klaus, > > On Friday, July 17, 2026 9:45 AM, Klaus Gerlicher wrote: > > 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. If, due > > to imprecise page fault reporting, a breakpoint is at the same address as > > the fault address, this signal would always be reported as > GDB_SIGNAL_TRAP. > > > > 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. > > It seems gdbarch.py has been updated since the last time you generated > gdbarch files. > Re-generating gives the diff below. The patch LGTM with that fixed. > > Reviewed-By: Tankut Baris Aktemur <[email protected]> > > Thank you. > -Baris > > > diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c > index d9bb3e7078c..0b815296261 100644 > --- a/gdb/gdbarch-gen.c > +++ b/gdb/gdbarch-gen.c > @@ -5295,8 +5295,8 @@ set_gdbarch_get_shadow_stack_pointer (struct > gdbarch *gdbarch, > bool > gdbarch_imprecise_pagefault_reporting (struct gdbarch *gdbarch) > { > - gdb_assert (gdbarch != NULL); > - gdb_assert (gdbarch->imprecise_pagefault_reporting != NULL); > + gdb_assert (gdbarch != nullptr); > + gdb_assert (gdbarch->imprecise_pagefault_reporting != nullptr); > if (gdbarch_debug >= 2) > gdb_printf (gdb_stdlog, "gdbarch_imprecise_pagefault_reporting > called\n"); > return gdbarch->imprecise_pagefault_reporting (); > diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h > index bb95df25eb6..a96692c206c 100644 > --- a/gdb/gdbarch-gen.h > +++ b/gdb/gdbarch-gen.h > @@ -1756,6 +1756,6 @@ void set_gdbarch_get_shadow_stack_pointer > (struct gdbarch *gdbarch, gdbarch_get_ > /* Returns true if architecture has imprecise pagefault reporting. This is > used in conversion of SIGSEGV to SIGTRAP for an architecture. */ > > -typedef bool (gdbarch_imprecise_pagefault_reporting_ftype) (); > -extern bool gdbarch_imprecise_pagefault_reporting (struct gdbarch > *gdbarch); > -extern void set_gdbarch_imprecise_pagefault_reporting (struct gdbarch > *gdbarch, gdbarch_imprecise_pagefault_reporting_ftype > *imprecise_pagefault_reporting); > +using gdbarch_imprecise_pagefault_reporting_ftype = bool (); > +bool gdbarch_imprecise_pagefault_reporting (struct gdbarch *gdbarch); > +void set_gdbarch_imprecise_pagefault_reporting (struct gdbarch *gdbarch, > gdbarch_imprecise_pagefault_reporting_ftype > *imprecise_pagefault_reporting); > Intel Deutschland GmbH Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany Tel: +49 89 991 430, www.intel.de Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell Chairperson of the Supervisory Board: Nicole Lau Registered Seat: Munich Commercial Register: Amtsgericht Muenchen HRB 186928