This is the mail archive of the gdb-patches@sources.redhat.com 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] |
How come it doesn't work?
Popping the caller's frame should (assuming the unwind info is correct) restore the struct-return address register to the value that the callee expects. return_value can then use that register value to find the location at which to store the struct?
The problem is in the "assuming the unwind info is correct". It's not there. It will probably never be there. This isn't a normal register save/restore. The incoming address will be on the stack. The callee moves it into %eax somewhere, but we don't know where and when. You simply can't express this in DWARF2 CFI.
Now, we could do some nifty prologue/epilogue analysis and make a good guess at where the address is stored. Compilers seem to either do the move in the prologue (as the SVR4 ABI suggests, see i386_analyze_struct_return()) or leave the address on the stack until the epilogue (as GCC does). However, we can never be sure. This would lead to the unreliabilities you were trying to get rid of when gdbarch_return_value() was instroduced.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |