text file formats

Eli Zaretskii eliz@gnu.org
Thu Apr 6 03:47:00 GMT 2006


> Date: Wed, 5 Apr 2006 19:39:38 -0400
> From: Daniel Jacobowitz <drow@false.org>
> 
> GDB does something much simpler.  It opens the file in text mode and
> lets the C library sort it out.
> 
> Well, usually.  In search and reverse search it sometimes uses a
> similar but slightly simpler algorithm: ignore '\r' if followed by
> '\n'.  I'm not sure why those are done in binary mode.

I think it's because GDB counts characters and then lseeks to the
point it thinks it should display.  If the library's text-mode I/O
converts \r\n to \n, this seeks will only work reliably in binary
mode, since most DOS/Windows libraries don't seek to the correct place
(the only exception from this rule I know of is the DJGPP library).



More information about the Gdb mailing list