mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
gdb/
Remove the PROT parameter from openp. * source.c (openp): Remove the parameter PROT. Assertion check MODE. defs.h (openp): Update the prototype. Update all the openp callers.
This commit is contained in:
parent
5fd62852f6
commit
fbdebf4657
@ -1,3 +1,10 @@
|
||||
2009-05-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Remove the PROT parameter from openp.
|
||||
* source.c (openp): Remove the parameter PROT. Assertion check MODE.
|
||||
defs.h (openp): Update the prototype.
|
||||
Update all the openp callers.
|
||||
|
||||
2009-05-19 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* inflow.c (kill_command): Moved to infcmd.c.
|
||||
|
@ -451,7 +451,7 @@ source_script (char *file, int from_tty)
|
||||
/* Search for and open 'file' on the search path used for source
|
||||
files. Put the full location in 'full_pathname'. */
|
||||
fd = openp (source_path, OPF_TRY_CWD_FIRST,
|
||||
file, O_RDONLY, 0, &full_pathname);
|
||||
file, O_RDONLY, &full_pathname);
|
||||
make_cleanup (xfree, full_pathname);
|
||||
|
||||
/* Use the full path name, if it is found. */
|
||||
|
@ -619,7 +619,7 @@ extern void print_address (CORE_ADDR, struct ui_file *);
|
||||
#define OPF_TRY_CWD_FIRST 0x01
|
||||
#define OPF_SEARCH_IN_PATH 0x02
|
||||
|
||||
extern int openp (const char *, int, const char *, int, int, char **);
|
||||
extern int openp (const char *, int, const char *, int, char **);
|
||||
|
||||
extern int source_full_path_of (const char *, char **);
|
||||
|
||||
|
@ -197,7 +197,7 @@ exec_file_attach (char *filename, int from_tty)
|
||||
int scratch_chan;
|
||||
|
||||
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
|
||||
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
|
||||
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
|
||||
&scratch_pathname);
|
||||
#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
|
||||
if (scratch_chan < 0)
|
||||
@ -205,7 +205,7 @@ exec_file_attach (char *filename, int from_tty)
|
||||
char *exename = alloca (strlen (filename) + 5);
|
||||
strcat (strcpy (exename, filename), ".exe");
|
||||
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
|
||||
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, 0,
|
||||
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
|
||||
&scratch_pathname);
|
||||
}
|
||||
#endif
|
||||
|
@ -145,7 +145,7 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
|
||||
else
|
||||
base++; /* Skip over '/'. */
|
||||
|
||||
ret = openp (buf, 1, base, o_flags, 0, temp_pathname);
|
||||
ret = openp (buf, 1, base, o_flags, temp_pathname);
|
||||
if (ret < 0 && base != solib)
|
||||
{
|
||||
sprintf (arch_path, "/%s", solib);
|
||||
|
@ -210,14 +210,14 @@ solib_find (char *in_pathname, int *fd)
|
||||
/* If not found, search the solib_search_path (if any). */
|
||||
if (found_file < 0 && solib_search_path != NULL)
|
||||
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
|
||||
in_pathname, O_RDONLY | O_BINARY, 0, &temp_pathname);
|
||||
in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
|
||||
|
||||
/* If not found, next search the solib_search_path (if any) for the basename
|
||||
only (ignoring the path). This is to allow reading solibs from a path
|
||||
that differs from the opened path. */
|
||||
if (found_file < 0 && solib_search_path != NULL)
|
||||
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
|
||||
lbasename (in_pathname), O_RDONLY | O_BINARY, 0,
|
||||
lbasename (in_pathname), O_RDONLY | O_BINARY,
|
||||
&temp_pathname);
|
||||
|
||||
/* If not found, try to use target supplied solib search method */
|
||||
@ -228,14 +228,14 @@ solib_find (char *in_pathname, int *fd)
|
||||
/* If not found, next search the inferior's $PATH environment variable. */
|
||||
if (found_file < 0 && gdb_sysroot_is_empty)
|
||||
found_file = openp (get_in_environ (inferior_environ, "PATH"),
|
||||
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
|
||||
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
|
||||
&temp_pathname);
|
||||
|
||||
/* If not found, next search the inferior's $LD_LIBRARY_PATH
|
||||
environment variable. */
|
||||
if (found_file < 0 && gdb_sysroot_is_empty)
|
||||
found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
|
||||
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY, 0,
|
||||
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
|
||||
&temp_pathname);
|
||||
|
||||
*fd = found_file;
|
||||
|
17
gdb/source.c
17
gdb/source.c
@ -658,7 +658,8 @@ is_regular_file (const char *name)
|
||||
}
|
||||
|
||||
/* Open a file named STRING, searching path PATH (dir names sep by some char)
|
||||
using mode MODE and protection bits PROT in the calls to open.
|
||||
using mode MODE in the calls to open. You cannot use this function to
|
||||
create files (O_CREAT).
|
||||
|
||||
OPTS specifies the function behaviour in specific cases.
|
||||
|
||||
@ -685,8 +686,7 @@ is_regular_file (const char *name)
|
||||
>>>> eg executable, non-directory */
|
||||
int
|
||||
openp (const char *path, int opts, const char *string,
|
||||
int mode, int prot,
|
||||
char **filename_opened)
|
||||
int mode, char **filename_opened)
|
||||
{
|
||||
int fd;
|
||||
char *filename;
|
||||
@ -695,6 +695,9 @@ openp (const char *path, int opts, const char *string,
|
||||
int len;
|
||||
int alloclen;
|
||||
|
||||
/* The open syscall MODE parameter is not specified. */
|
||||
gdb_assert ((mode & O_CREAT) == 0);
|
||||
|
||||
if (!path)
|
||||
path = ".";
|
||||
|
||||
@ -708,7 +711,7 @@ openp (const char *path, int opts, const char *string,
|
||||
{
|
||||
filename = alloca (strlen (string) + 1);
|
||||
strcpy (filename, string);
|
||||
fd = open (filename, mode, prot);
|
||||
fd = open (filename, mode);
|
||||
if (fd >= 0)
|
||||
goto done;
|
||||
}
|
||||
@ -827,7 +830,7 @@ source_full_path_of (const char *filename, char **full_pathname)
|
||||
int fd;
|
||||
|
||||
fd = openp (source_path, OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH, filename,
|
||||
O_RDONLY, 0, full_pathname);
|
||||
O_RDONLY, full_pathname);
|
||||
if (fd < 0)
|
||||
{
|
||||
*full_pathname = NULL;
|
||||
@ -1017,13 +1020,13 @@ find_and_open_source (struct objfile *objfile,
|
||||
}
|
||||
}
|
||||
|
||||
result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, 0, fullname);
|
||||
result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, fullname);
|
||||
if (result < 0)
|
||||
{
|
||||
/* Didn't work. Try using just the basename. */
|
||||
p = lbasename (filename);
|
||||
if (p != filename)
|
||||
result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, 0, fullname);
|
||||
result = openp (path, OPF_SEARCH_IN_PATH, p, OPEN_MODE, fullname);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1585,14 +1585,14 @@ symfile_bfd_open (char *name)
|
||||
|
||||
/* Look down path for it, allocate 2nd new malloc'd copy. */
|
||||
desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, name,
|
||||
O_RDONLY | O_BINARY, 0, &absolute_name);
|
||||
O_RDONLY | O_BINARY, &absolute_name);
|
||||
#if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__)
|
||||
if (desc < 0)
|
||||
{
|
||||
char *exename = alloca (strlen (name) + 5);
|
||||
strcat (strcpy (exename, name), ".exe");
|
||||
desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
|
||||
O_RDONLY | O_BINARY, 0, &absolute_name);
|
||||
O_RDONLY | O_BINARY, &absolute_name);
|
||||
}
|
||||
#endif
|
||||
if (desc < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user