[PATCH v2 02/15] Fix calling ifunc functions when resolver has debug info and different name

Pedro Alves palves@redhat.com
Tue Apr 10 21:20:00 GMT 2018


Hi Simon,

On 04/01/2018 04:44 AM, Simon Marchi wrote:
>> diff --git a/gdb/c-exp.y b/gdb/c-exp.y
>> index 8dc3c068a5e..e2ea07cd792 100644
>> --- a/gdb/c-exp.y
>> +++ b/gdb/c-exp.y
>> @@ -1081,7 +1081,9 @@ variable:	name_not_typename
>>  				 is important for example for "p
>>  				 *__errno_location()".  */
>>  			      symbol *alias_target
>> -				= find_function_alias_target (msymbol);
>> +				= (msymbol.minsym->type != mst_text_gnu_ifunc
>> +				   ? find_function_alias_target (msymbol)
>> +				   : NULL);
>>  			      if (alias_target != NULL)
>>  				{
>>  				  write_exp_elt_opcode (pstate, OP_VAR_VALUE);
>>
> 
> Just one question, to which I really don't have a preconceived answer:
> 
> Would it make sense to add that filtering to find_function_alias_target or
> another function deeper in the call chain instead?  In other words, would
> it ever make sense for find_function_alias_target to return an non-NULL
> result for an mst_text_gnu_ifunc minimal symbol?

For ifuncs, find_function_alias_target will finds the debug symbol for
the resolver.  If that has a different name from the ifunc (it will
if you use gcc's attribute ifunc, then it'll work the same as any other
minsym, in the sense that it'll find an alias.

So from that angle, the function works as intended, and it
wasn't clear that we'll always want to treat ifuncs differently.
Note this is the only caller of find_function_alias_target currently.

Another reason for leaving the check here is that patch #4 adds
another case of "do this for ifuncs" just above this code, but for
the "sym.symbol" case.  It felt better to keep both of the
"for ifunc, do this" cases close together.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list