Re: [PATCH 1/4] New gdb arch hook: return_with_first_hidden_param_p

Yao Qi
2012-05-11T10:35:12Z

On 05/11/2012 05:20 AM, Joel Brobecker wrote:
>> > Agreed. I stared at these debug info for a while, but unable to have
>> > a clue on heuristics. My feeling is that these debug info doesn't give
>> > us more than what source code can give, but the heuristics we are looking
>> > for are about the difference on different targets, given the same source.
>> > That is to say, on different targets, although the number of parameters
>> > is different, the debug info is almost the same and hard to get heuristics,
> Can we use the fact that functions that have their first parameter
> be a nameless, artificial, paramter whose type is a pointer to
> the return type? Or would this heuristics trigger in other situations?
>

Yeah, I thought of that heuristics, but it still can't differentiate
passing 3 or 4 parameters.

So far, the discussion in dwarf-discuss@ gives me a feeling that
"DW_AT_artificial_type"/"DW_ART_return_block" looks quite promising for
this problem, but it requires changes in gcc/binutils, and I haven't
investigate the history of it to see why it is ada-specific, instead of
a general attribute.

> If that doesn't work, then I am running out of ideas, and then we'll
> have to start looking giving GDB insider knowledge. But I really don't
> like that idea.

Well, we have to compromise :) Could you please re-consider this patch
series, as it is a trade-off, and not perfect?

If this patch series is still not acceptable, we may create a variant
(or sub-class) of gnu-v3-abi, say "gnu-v3-pass-implicit-param" or
something similar, for targets affected by this problem, and
`set_cp_abi_as_auto_default ("gnu-v3-pass-implicit-param")' in each
target backend. (This is my rough thought, and need some experiments to
see it works or not). Even, if GCC in the future starts to pass
implicit parameter for these ports, we can switch to gnu-v3, and users
just have to type `set cp-abi gnu-v3' without rebuilding their GDB.

--
Yao (é½å°§)