mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-18 05:12:33 +08:00
Wed Apr 8 16:57:22 1998 Philippe De Muyter <phdm@macqel.be>
* source.c: Remove obsolete decl of strstr().
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
Wed Apr 8 16:57:22 1998 Philippe De Muyter <phdm@macqel.be>
|
||||||
|
|
||||||
|
* source.c: Remove obsolete decl of strstr().
|
||||||
|
|
||||||
Wed Apr 8 16:47:33 1998 Jason Molenda (crash@bugshack.cygnus.com)
|
Wed Apr 8 16:47:33 1998 Jason Molenda (crash@bugshack.cygnus.com)
|
||||||
|
|
||||||
* solib.c (solib_create_inferior_hook): Remove Ulrich Drepper's
|
* solib.c (solib_create_inferior_hook): Remove Ulrich Drepper's
|
||||||
|
51
gdb/source.c
51
gdb/source.c
@ -1,5 +1,5 @@
|
|||||||
/* List lines of source files for GDB, the GNU debugger.
|
/* List lines of source files for GDB, the GNU debugger.
|
||||||
Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995
|
Copyright 1986, 87, 88, 89, 91, 92, 93, 94, 95, 96, 1997
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
@ -41,6 +41,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include "annotate.h"
|
#include "annotate.h"
|
||||||
#include "gdbtypes.h"
|
#include "gdbtypes.h"
|
||||||
|
|
||||||
|
#ifdef CRLF_SOURCE_FILES
|
||||||
|
|
||||||
|
/* Define CRLF_SOURCE_FILES in an xm-*.h file if source files on the
|
||||||
|
host use \r\n rather than just \n. Defining CRLF_SOURCE_FILES is
|
||||||
|
much faster than defining LSEEK_NOT_LINEAR. */
|
||||||
|
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPEN_MODE (O_RDONLY | O_BINARY)
|
||||||
|
#define FDOPEN_MODE FOPEN_RB
|
||||||
|
|
||||||
|
#else /* ! defined (CRLF_SOURCE_FILES) */
|
||||||
|
|
||||||
|
#define OPEN_MODE O_RDONLY
|
||||||
|
#define FDOPEN_MODE FOPEN_RT
|
||||||
|
|
||||||
|
#endif /* ! defined (CRLF_SOURCE_FILES) */
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
|
|
||||||
static int open_source_file PARAMS ((struct symtab *));
|
static int open_source_file PARAMS ((struct symtab *));
|
||||||
@ -63,11 +83,6 @@ static void show_directories PARAMS ((char *, int));
|
|||||||
|
|
||||||
static void find_source_lines PARAMS ((struct symtab *, int));
|
static void find_source_lines PARAMS ((struct symtab *, int));
|
||||||
|
|
||||||
/* If we use this declaration, it breaks because of fucking ANSI "const" stuff
|
|
||||||
on some systems. We just have to not declare it at all, have it default
|
|
||||||
to int, and possibly botch on a few systems. Thanks, ANSIholes... */
|
|
||||||
/* extern char *strstr(); */
|
|
||||||
|
|
||||||
/* Path of directories to search for source files.
|
/* Path of directories to search for source files.
|
||||||
Same format as the PATH environment variable's value. */
|
Same format as the PATH environment variable's value. */
|
||||||
|
|
||||||
@ -184,6 +199,8 @@ select_source_symtab (s)
|
|||||||
current_source_symtab = PSYMTAB_TO_SYMTAB (cs_pst);
|
current_source_symtab = PSYMTAB_TO_SYMTAB (cs_pst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (current_source_symtab)
|
||||||
|
return;
|
||||||
|
|
||||||
error ("Can't find a default source file");
|
error ("Can't find a default source file");
|
||||||
}
|
}
|
||||||
@ -607,7 +624,7 @@ open_source_file (s)
|
|||||||
/* Quick way out if we already know its full name */
|
/* Quick way out if we already know its full name */
|
||||||
if (s->fullname)
|
if (s->fullname)
|
||||||
{
|
{
|
||||||
result = open (s->fullname, O_RDONLY);
|
result = open (s->fullname, OPEN_MODE);
|
||||||
if (result >= 0)
|
if (result >= 0)
|
||||||
return result;
|
return result;
|
||||||
/* Didn't work -- free old one, try again. */
|
/* Didn't work -- free old one, try again. */
|
||||||
@ -636,13 +653,13 @@ open_source_file (s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = openp (path, 0, s->filename, O_RDONLY, 0, &s->fullname);
|
result = openp (path, 0, s->filename, OPEN_MODE, 0, &s->fullname);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
/* Didn't work. Try using just the basename. */
|
/* Didn't work. Try using just the basename. */
|
||||||
p = basename (s->filename);
|
p = basename (s->filename);
|
||||||
if (p != s->filename)
|
if (p != s->filename)
|
||||||
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
result = openp (path, 0, p, OPEN_MODE, 0, &s->fullname);
|
||||||
}
|
}
|
||||||
#ifdef MPW
|
#ifdef MPW
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
@ -650,14 +667,14 @@ open_source_file (s)
|
|||||||
/* Didn't work. Try using just the MPW basename. */
|
/* Didn't work. Try using just the MPW basename. */
|
||||||
p = (char *) mpw_basename (s->filename);
|
p = (char *) mpw_basename (s->filename);
|
||||||
if (p != s->filename)
|
if (p != s->filename)
|
||||||
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
result = openp (path, 0, p, OPEN_MODE, 0, &s->fullname);
|
||||||
}
|
}
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
/* Didn't work. Try using the mixed Unix/MPW basename. */
|
/* Didn't work. Try using the mixed Unix/MPW basename. */
|
||||||
p = (char *) mpw_mixed_basename (s->filename);
|
p = (char *) mpw_mixed_basename (s->filename);
|
||||||
if (p != s->filename)
|
if (p != s->filename)
|
||||||
result = openp (path, 0, p, O_RDONLY, 0, &s->fullname);
|
result = openp (path, 0, p, OPEN_MODE, 0, &s->fullname);
|
||||||
}
|
}
|
||||||
#endif /* MPW */
|
#endif /* MPW */
|
||||||
|
|
||||||
@ -955,7 +972,7 @@ print_source_lines (s, line, stopline, noerror)
|
|||||||
perror_with_name (s->filename);
|
perror_with_name (s->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = fdopen (desc, FOPEN_RT);
|
stream = fdopen (desc, FDOPEN_MODE);
|
||||||
clearerr (stream);
|
clearerr (stream);
|
||||||
|
|
||||||
while (nlines-- > 0)
|
while (nlines-- > 0)
|
||||||
@ -970,6 +987,12 @@ print_source_lines (s, line, stopline, noerror)
|
|||||||
printf_filtered ("^%c", c + 0100);
|
printf_filtered ("^%c", c + 0100);
|
||||||
else if (c == 0177)
|
else if (c == 0177)
|
||||||
printf_filtered ("^?");
|
printf_filtered ("^?");
|
||||||
|
#ifdef CRLF_SOURCE_FILES
|
||||||
|
else if (c == '\r')
|
||||||
|
{
|
||||||
|
/* Just skip \r characters. */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
printf_filtered ("%c", c);
|
printf_filtered ("%c", c);
|
||||||
} while (c != '\n' && (c = fgetc (stream)) >= 0);
|
} while (c != '\n' && (c = fgetc (stream)) >= 0);
|
||||||
@ -1309,7 +1332,7 @@ forward_search_command (regex, from_tty)
|
|||||||
perror_with_name (current_source_symtab->filename);
|
perror_with_name (current_source_symtab->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = fdopen (desc, FOPEN_RT);
|
stream = fdopen (desc, FDOPEN_MODE);
|
||||||
clearerr (stream);
|
clearerr (stream);
|
||||||
while (1) {
|
while (1) {
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
@ -1394,7 +1417,7 @@ reverse_search_command (regex, from_tty)
|
|||||||
perror_with_name (current_source_symtab->filename);
|
perror_with_name (current_source_symtab->filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = fdopen (desc, FOPEN_RT);
|
stream = fdopen (desc, FDOPEN_MODE);
|
||||||
clearerr (stream);
|
clearerr (stream);
|
||||||
while (line > 1)
|
while (line > 1)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user