Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Chastain <mec.gnu@mindspring.com>
To: gdb@sources.redhat.com, Cenedese@indel.ch
Subject: Re: gdb and older cygwins
Date: Thu, 26 Aug 2004 12:53:00 -0000	[thread overview]
Message-ID: <412DDD3B.nail3NS112HDC@mindspring.com> (raw)
In-Reply-To: <5.2.0.9.1.20040826130046.01d35970@NT_SERVER>

Fabian Cenedese <Cenedese@indel.ch> wrote:
> PS: The other solution would be to fix the 2.95.3 source about this
> CRLF bug. I looked into the gcc list but couldn't find simple patches,
> I guess it needs a bigger change. If anyone has some hints about it...

Well first, gcc 2.95.3 is no longer supported on Cygwin.
So you are on your own.  But I do have some hints about it.

gcc 2.95.3 has two preprocessors: the old standalone preprocessor
in cccp.c, and the new integrated preprocessor library in cpp*.c.
The old standalone preprocessor is the default.

The old standalone preprocessor is in cccp.  It's all about
'\\' and '\n' and doesn't understand '\r' very well.

I can think of six strategies to try:

(1)  Go into cccp.c and fix every occurrence of '\\' '\n' tests to
     accept '\\' '\r' '\n' as well.

(2)  Hack on safe_read so that it converts "\r\n" => "\n".
     Essentially you need to allocate a private buffer,
     do the raw read into the private buffer, and then translate
     from the private buffer to the caller-supplied buffer.

     A problem occurs when the '\r' happens at the end of one
     read and the '\n' happens at the beginning of the next read.

(3A) Change every occurence of "open" to include O_TEXT as part
     of the mode.  That is what O_TEXT is for!  It ought to work
     great, except that it only works on systems that actually
     support O_TEXT, like Cygwin.  You would still not be able to
     compile your "\r\n" files on a non-Cygwin system with
     gcc 2.95.3.

(3B) Like 3A, only copy a trick from the VMS support code:

       #if defined(__CYGWIN__)
       #define open(fname,mode,prot)  open(fname,(mode|O_TEXT),prot)
       #endif

     That might actually be all the code you need!

(4) Try building gcc with the new integrated preprocessor instead
    of the old standalone preprocessor.  Configure with
    --enable-cpplib or with --disable-cpp --enable-cpplib.
    However, this was all new code in 2.95.3, so it might have
    had new and exciting bugs.

(5) Mount your Cygwin filesystems with the "text" option.
    All Cygwin programs will see "\n" line endings instead of
    "\r\n".  This is likely to fix the problems with gcc,
    but cause other random problems with other random programs.

I would recommend (3B), followed by (1).  (2) is attractive but
if you don't handle the edge case then you will have random
intermittent losses.  (4) and (5) have side effects that you
would have to handle.

Hope this helps,

Michael Chastain


  reply	other threads:[~2004-08-26 12:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-26 11:10 Fabian Cenedese
2004-08-26 12:53 ` Michael Chastain [this message]
2004-08-26 13:23   ` Fabian Cenedese
2004-08-26 14:23   ` Dave Korn
2004-08-26 14:56     ` Fabian Cenedese
2004-08-26 16:10       ` Dave Korn
2004-08-27  7:28         ` Fabian Cenedese

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=412DDD3B.nail3NS112HDC@mindspring.com \
    --to=mec.gnu@mindspring.com \
    --cc=Cenedese@indel.ch \
    --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