This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [V2 PATCH 0/5] Handle first hidden parameter


On 05/29/2012 04:31 AM, Mark Kettenis wrote:
>> > The version 1 was approved by Tom, but Mark K. thinks "first hidden
>> > parameter" is special in language c++ on some arch, instead of
>> > all languages.
> That's not quite what I said.  I said it was specific to the C++ ABI
> implemented by GCC.  Which is why I suggested calling the new gdbarch
> hook from gnu-v3-abi.c.
> 

I thought of that, but it doesn't work.
gnu-v3-abi.c:gnuv3_pass_by_reference will be used for two cases, 'pass
parameter' and 'pass return value'.  We are only interested in the
latter case and call hook method.  However, inside of it, we don't know
function pass_by_reference is called for which purpose, unless we add an
extra parameter in function pass_by_reference to differentiate two
cases.  This change is equivalent to mine.

>> >   http://sourceware.org/ml/gdb-patches/2012-05/msg00671.html
>> > 
>> > I re-design this patch a little bit.  In version 2, the "first
>> > hidden parameter" is treated as a special feature of a combination
>> > of a certain language and a certain arch.  I add new language
>> > hook 'la_return_by_reference', which is equal to
>> > 'la_pass_by_reference' in default, and I overwrite the default
>> > in language c++ to honour gdbarch_return_in_first_hidden_param.
>> > In this way, we can reduce the impact of this change on a certain
>> > arch in c++ only.
> Sorry, but in my opinion this makes things more complicated for no
> apparent reason.

First of all, I hate to write code in a complicated way.  However, the
reason for such complication is hook la_pass_by_reference in 'struct
language_defn" is used for both 'pass param' and 'return value'.  In
order to differentiate, we either have to add a parameter or add a new
hook in 'struct language_defn'.

-- 
Yao (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]