Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v2 0/1] gdb: Preserve IFUNC marker when finding inferior functions
@ 2026-06-25 15:20 Muhammad Kamran
  2026-06-25 15:20 ` [PATCH v2 1/1] " Muhammad Kamran
  0 siblings, 1 reply; 18+ messages in thread
From: Muhammad Kamran @ 2026-06-25 15:20 UTC (permalink / raw)
  To: gdb-patches
  Cc: Andrew Burgess, Wilco Dijkstra, Yury Khrustalev,
	Thiago Jung Bauermann, Adhemerval Zanella Netto,
	Carlos O'Donell, Muhammad Kamran

This patch fixes a GDB inferior-call issue exposed by malloc being a GNU
IFUNC in glibc on AArch64.  The underlying problem is not AArch64-specific:
it can affect any inferior helper found through find_function_in_inferior's
minimal-symbol fallback when that helper is a GNU IFUNC.

GDB calls find_function_in_inferior ("malloc") when expression evaluation
needs to allocate memory in the inferior, for example for string literal
arguments.  In the minimal-symbol fallback, GDB created a synthetic ordinary
function pointer from the minimal symbol address.  If the symbol was a GNU
IFUNC, this lost the IFUNC marker, so call_function_by_hand did not resolve
the symbol before calling it.

The patch uses find_minsym_type_and_address to classify the minimal symbol
and propagates the IFUNC marker to the synthetic function type when needed.
The existing fallback return type is unchanged.

Changes since v1:
	* Reword the commit message.
	* Add a test case using a no-debug IFUNC malloc to exercise the
	  minimal-symbol fallback.

Muhammad Kamran (1):
  gdb: Preserve IFUNC marker when finding inferior functions

 .../gdb.base/gnu-ifunc-inferior-call-malloc.c | 27 +++++++++++
 .../gdb.base/gnu-ifunc-inferior-call.c        | 45 +++++++++++++++++++
 gdb/testsuite/gdb.base/gnu-ifunc.exp          | 40 +++++++++++++++++
 gdb/valops.c                                  |  6 ++-
 4 files changed, 117 insertions(+), 1 deletion(-)
 create mode 100644 gdb/testsuite/gdb.base/gnu-ifunc-inferior-call-malloc.c
 create mode 100644 gdb/testsuite/gdb.base/gnu-ifunc-inferior-call.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-07-22 13:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-25 15:20 [PATCH v2 0/1] gdb: Preserve IFUNC marker when finding inferior functions Muhammad Kamran
2026-06-25 15:20 ` [PATCH v2 1/1] " Muhammad Kamran
2026-06-25 20:05   ` Simon Marchi
2026-06-26  9:24     ` Muhammad Kamran
2026-06-26 14:20       ` Simon Marchi
2026-06-29 15:43         ` Muhammad Kamran
2026-06-29 21:11   ` Florian Weimer
2026-06-30  9:13     ` Yury Khrustalev
2026-06-30  9:18     ` Yury Khrustalev
2026-06-30  9:42       ` Wilco Dijkstra
2026-06-30 11:53         ` Florian Weimer
2026-07-21 17:10           ` Tom Tromey
2026-07-21 19:45             ` Florian Weimer
2026-07-22 13:36               ` Tom Tromey
2026-06-30 14:15     ` Muhammad Kamran
2026-06-30 15:29       ` Wilco Dijkstra
2026-07-03 12:56         ` Simon Marchi
2026-07-07 12:15           ` Muhammad Kamran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox