RE: [PATCH v4 1/1] gdb: avoid conversion of SIGSEGV to SIGTRAP on user breakpoints
"Aktemur, Baris" <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <DM4PR12MB6470472CBEC1DEC33E2F02ECF8C62@DM4PR12MB6470.namprd12.prod.outlook.com> |
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);