[Dwarf-Discuss] Location of a returned value?

Daniel Jacobowitz drow at false.org
Tue Jan 6 16:12:10 PST 2009

On Tue, Jan 06, 2009 at 01:54:47PM -0800, Jason Molenda wrote:
> The x86_64 ABI rules would say that a structure of two ints being  
> returned uses the small-struct-return aka pcc aka in-register return  
> convention.  However the C++ ABI overrides that convention in this case 
> and the large-struct-return aka caller-allocated-memory convention must be 
> used.  If you're stepping through main() in gdb and you call the make_f() 
> function from gdb, make_f() will get a random 0th argument where it should 
> store its returned structure (which may result in the program crashing) 
> and even if it works, gdb won't know where to retrieve the return value 
> from so it'll show you random junk.

FYI, this is no longer true.  I fixed it last year.  It's not a
property of the function but a property of the type, and with
knowledge of the C++ ABI and correct DW_AT_artificial the required
information is present.

(This is distinct from Andrew's scenario.)

Daniel Jacobowitz

More information about the Dwarf-Discuss mailing list