delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/07/14:46:39

Date: Wed, 7 Jun 1995 10:26:40 -0700
From: pierre AT phi DOT la DOT tce DOT com (Pierre Willard)
To: bug-gdb AT prep DOT ai DOT mit DOT edu, djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: problem bfd_fdopenr gdb-4.13 for DJGPP
Reply-To: pierre AT la DOT tce DOT com
Cc: pattabhi AT la DOT tce DOT com

There is a small problem in the BFD library when compiling for DJGPP
(gdb-4.12 and gdb-4.13).

In bfd_fdopenr function (opncls.c) there is the following code :

#if defined(VMS) || defined(__GO32__)
  nbfd->iostream = (char *)fopen(filename, FOPEN_RB);
#else
  /* (O_ACCMODE) parens are to avoid Ultrix header file bug */
  switch (fdflags & (O_ACCMODE)) {
  case O_RDONLY: nbfd->iostream = (char *) fdopen (fd, FOPEN_RB);   break;
  case O_WRONLY: nbfd->iostream = (char *) fdopen (fd, FOPEN_RUB);  break;
  case O_RDWR:   nbfd->iostream = (char *) fdopen (fd, FOPEN_RUB);  break;
  default: abort ();
  }
#endif

The problem with this code is that , when __GO32__ is defined, 'fd' is not
used at all, and thus bfd_close will NOT close this 'fd' ! This is a
problem when doing several 'exec-file' commands in a gdb session.

One possible fix would be to use DJGPP's fdopen. Does anybody knows why
fdopen is not used here for DJGPP ?

Regards
Pierre Willard

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019