This is the mail archive of the gdb@sourceware.org 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]

Re: text file formats


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]