Hello Kamran,
Muhammad Kamran muhammad.kamran@arm.com writes:
On 23/06/2026 04:00, Thiago Jung Bauermann wrote:
Hello Yury, Yury Khrustalev Yury.Khrustalev@arm.com writes:
Notice first 2 instructions have now been re-written with gibberish (hence the signals).
I would appreciate if this could be looked at from the GDB point of view. Perhaps, this should be fixed in GDB?
FWIW, lldb works as expected.
Thank you for the investigation and the detailed report. I was able to reproduce the problem and will work on a fix.
I’ve spent some time looking into this issue. The problem appears to be in find_function_in_inferior, which GDB uses when expression evaluation needs to call functions in the inferior, such as malloc for allocating storage for string literal arguments.
When the lookup falls back to a minimal symbol, GDB constructs a synthetic function type from the symbol address. For GNU IFUNC symbols such as malloc, this path loses the IFUNC marker, causing the inferior call machinery to treat the symbol as an ordinary function and skip IFUNC resolution.
Great! Thank you for the investigation and analysis!
The patch below preserves the IFUNC property when creating the synthetic function type. With this change, Yury’s reproducer behaves correctly on my setup.
Does this look like a reasonable approach to you?
It does, thank you for the patch! I can add my Reviewed-by when you post it on the mailing list.
As a bit of a rambling side note, I thought it was strange that the call to lookup_symbol at the beginning of find_function_in_inferior is using SEARCH_TYPE_DOMAIN. I thought it made more sense if it used SEARCH_FUNCTION_DOMAIN so I made that change to see if it would also fix the bug (at least when libc6 has debug info available), but it didn't. I even changed it to SEARCH_VAR_DOMAIN because of the comment saying that C functions are in the VAR domain, but it also didn't fix the bug.