Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Bob Rossi <bob_rossi@cox.net>
To: gdb@sources.redhat.com
Subject: Re: text file formats
Date: Thu, 06 Apr 2006 03:27:00 -0000	[thread overview]
Message-ID: <20060406032702.GE11610@brasko.net> (raw)
In-Reply-To: <20060406011732.GA12814@nevyn.them.org>

On Wed, Apr 05, 2006 at 09:17:32PM -0400, Daniel Jacobowitz wrote:
> On Wed, Apr 05, 2006 at 08:14:55PM -0400, Bob Rossi wrote:
> > OK, so now I'm confused. If the user looks at the text file through my
> > viewer, and set's a breakpoint at line 100, how can I be sure it's the
> > same 100 that GDB will actually set a breakpoint at? Obviously this
> > works for unix and dos file formats. But from the algorithm you stated
> > above, it doesn't look like GDB will work with mac file formats.
> > 
> > I mean, the C library on unix won't be able to read a file that was
> > created on a mac (at least with the mac file format).
> 
> The manual algorithm is only used while searching.  It will work on any
> file format recognized by the C library.
> 
> The C library is generally used.  If you want to handle a text file,
> including a source file, it had better be in the native format.  Full
> stop.
> 
> I don't think any recent version of MacOS uses the old \r format,
> anyway?  I thought OSX had switched to the Unix convention.

Sure, but for some reason the file '/usr/include/g++-3/sstream' on red
hat enterprise 3 has mixed file formats. So, this becomes a practical
issue, not just a theoretical one. Here is an example from 
'od -a /usr/include/g++-3/sstream
0007400   h   )  cr  nl  sp  sp  sp  sp   {  sp   }  cr  nl  nl  sp  sp
The 'cr nl' is "\r\n" and the extra "nl" is "\n". Opening this file in
vim shows the ^M at the end of each line.

> > Is GDB responsible for mapping the file line numbers to the actual lines?
> > or is this the responsibility of GCC via the debug info? For instance,
> > if foo () is defined at line 100 according to gcc and 101 according to
> > GDB, does CGDB have to think foo () is at line 100 or 101?
> 
> I have no idea what you mean.  GDB gets line numbers from debug info,
> of course; where else would it get them?

Does the debug info actually say, "at line 100 symbol foo() exists?"
Meaning, does gcc calculate that information, or does GDB derive the
line number from the debug info?

OK, I'm sorry, as usual I'm describing this bad. Let's start out by
trying to agree with an assumption that I have. Since the file is in a
mixed format, is it true that the line number is determined ambiguously 
by the program reading the file?

Thanks,
Bob Rossi


  reply	other threads:[~2006-04-06  3:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05 22:31 Bob Rossi
2006-04-05 23:39 ` Daniel Jacobowitz
2006-04-06  0:14   ` Bob Rossi
2006-04-06  1:17     ` Daniel Jacobowitz
2006-04-06  3:27       ` Bob Rossi [this message]
2006-04-06  3:35         ` Eli Zaretskii
2006-04-06  5:06           ` Daniel Jacobowitz
2006-04-06 13:03             ` Daniel Jacobowitz
2006-04-06 14:01           ` Bob Rossi
2006-04-06 14:41             ` Daniel Jacobowitz
2006-04-06 19:20               ` Eli Zaretskii
2006-04-06 19:32                 ` Bob Rossi
2006-04-06 23:55                   ` Daniel Jacobowitz
2006-04-07 13:33                     ` Eli Zaretskii
2006-04-06 20:55                 ` Paul Koning
2006-04-07 11:54                   ` Eli Zaretskii
2006-04-06 19:07             ` Eli Zaretskii
2006-04-06  3:47   ` Eli Zaretskii
2006-04-06  4:29     ` Daniel Jacobowitz
2006-04-06  4:30       ` Daniel Jacobowitz
2006-04-06  3:43 ` Eli Zaretskii
2006-04-06 13:35   ` Bob Rossi
2006-04-06 19:01     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060406032702.GE11610@brasko.net \
    --to=bob_rossi@cox.net \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox