[RFC] cygwin GDB "long long" return value error

Pierre Muller pierre@idefix.wisa.be
Wed Oct 3 16:17:00 GMT 2001


  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).

  



More information about the Gdb mailing list