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


On Wed, Apr 05, 2006 at 06:31:22PM -0400, Bob Rossi wrote:
> One thing I have determined, is that in order to know what the file
> format is, the entire text file needs to be parsed. After that, either
> the file format is defined (unix/dos/mac) or it is undefined (mix of
> them).
> 
> I would like to make sure that the algorithm CGDB uses to determine
> the line number from a file is the same algorithm that GDB uses. Can
> anyone point me in the correct direction?

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.

-- 
Daniel Jacobowitz
CodeSourcery


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