From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Muller To: gdb@sourceware.cygnus.com Subject: [RFC] cygwin GDB "long long" return value error Date: Wed, 03 Oct 2001 16:17:00 -0000 Message-id: <3.0.6.32.20011004012430.010f56b0@idefix.wisa.be> X-SW-Source: 2001-10/msg00046.html The return value of a long long functions in value_being_returned (called in finish command) relies on the EXTRACT_RETURN_VALUE macro. This macro has a correct implementation in config/i386/tm-i386.h where 64bit integers are taken from the edx:eax pair. But config/i386/tm-i386v.h overwrites this macro by using memcpy on the register buffer, which then leads to using ecx:eax as return value. As cygwin version relies on tm-i386v.h, the 64bit integers are wrong. Do really some targets use ecx:eax, or is it just that 64bit was not considered at the time this macro was written? Anyhow STORE_RETURN_VALUE in config/i386/tm-i386.h suffers from the same error, the "long long" value will be copied into ecx:eax instead of edx:eax Simple test program : long long getval () { return 0x030000524f; } int main () { long long i = getval (); return 0; } Just put a break inside getval function and use 'finish' or 'return 0x300000000' to test if rading and writing works correctly. The display of the return value might be correct as it depends on the value contained in the ecx register. Several other i386 targets seem to include tm-i386v.h or use other function that also don't handle 64 bit return value correctly (unless these targets use ecx:eax).