On Thu, 2023-02-09 at 14:45 +0100, Mark Wielaard wrote: > Hi Ilya, > > On Wed, 2023-02-08 at 20:52 +0100, Ilya Leoshkevich wrote: > > On the low level, they are the same as pointers. > > Yes, I can see how that would work for return types. > Do you happen to have a testcase for this?
You can trigger the issue by compiling the following: $ cat 1.cpp int &foo() { throw; } int &&bar() { throw; } $ g++ -g 1.cpp -c and then running $ LD_LIBRARY_PATH=../libelf:../libdw ./funcretval -e 1.o What would be a good way to integrate such a testcase? Currently all tests are built with gcc, is it okay to add one built with g++? If not, I guess the alternative would be to check in multiple compressed object files built for different platforms? > Right below this code is a check whether the type has a > DW_AT_byte_size, and if not we'll assume 8 as (address) size if the > type is either DW_TAG_pointer_type or DW_TAG_ptr_to_member_type. > Should the same be done for DW_TAG_reference_type and > DW_TAG_rvalue_reference_type? Sounds reasonable. Here is what I have on x86_64: <1><5a>: Abbrev Number: 1 (DW_TAG_reference_type) <5b> DW_AT_byte_size : 8 <1><80>: Abbrev Number: 7 (DW_TAG_rvalue_reference_type) <81> DW_AT_byte_size : 8 IIUC these checks handle weird compilers that do not emit DW_AT_byte_size. > This doesn't seem x86_64 specific, other backends have similar code, > I > assume they all need a similar update? Oh, right, this issue seems to affect all of them. > Thanks, > > Mark > > > Signed-off-by: Ilya Leoshkevich <i...@linux.ibm.com> > > --- > > backends/x86_64_retval.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/backends/x86_64_retval.c b/backends/x86_64_retval.c > > index f9114cb1..e668eacc 100644 > > --- a/backends/x86_64_retval.c > > +++ b/backends/x86_64_retval.c > > @@ -106,6 +106,8 @@ x86_64_return_value_location (Dwarf_Die > > *functypedie, const Dwarf_Op **locp) > > case DW_TAG_enumeration_type: > > case DW_TAG_pointer_type: > > case DW_TAG_ptr_to_member_type: > > + case DW_TAG_reference_type: > > + case DW_TAG_rvalue_reference_type: > > { > > Dwarf_Attribute attr_mem; > > if (dwarf_formudata (dwarf_attr_integrate (typedie, > > DW_AT_byte_size, >