[gdbserver] Make mingw32ce gdbserver build again

Pedro Alves pedro@codesourcery.com
Thu Jan 31 18:45:00 GMT 2008


Daniel Jacobowitz wrote:
> On Thu, Jan 31, 2008 at 02:56:22AM +0000, Pedro Alves wrote:
>>  static void
>> -hostio_error (char *own_buf, int error)
>> +hostio_error (char *own_buf)
>>  {
>> -  int fileio_error = errno_to_fileio_errno (error);
>> -
>> -  sprintf (own_buf, "F-1,%x", fileio_error);
>> +  sprintf (own_buf, "F-1,");
>> +  the_target->hostio_last_error (own_buf + 4);
>>  }
>>  
> 
> Pretty much anything can change errno.  That includes sprintf.  So you
> have to save the value of errno before you call back into the C
> library, in general, or you might print some other error than the one
> you want.
> 
> For now, how about the_target->hostio_last_error which converts to a
> protocol error and returns that?  Then we can call it before sprintf.
> 

If you're going to accept my proposed extension to the protocol, then
I'd go the other direction and move the sprintf to the target method,
because then I'd write two numbers in own_buf; an int return
wouldn't suffice.  See attached.  I'll post the other patch seperatelly.

-- 
Pedro Alves

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wince_hostio.diff
Type: text/x-diff
Size: 14257 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080131/9fda88f7/attachment.bin>


More information about the Gdb-patches mailing list