mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-25 08:25:22 +08:00
Code cleanup: Change OPF_DISABLE_REALPATH to OPF_RETURN_REALPATH.
gdb/ 2013-09-04 Jan Kratochvil <jan.kratochvil@redhat.com> Code cleanup: Change OPF_DISABLE_REALPATH to OPF_RETURN_REALPATH. * cli/cli-cmds.c (find_and_open_script): Add OPF_RETURN_REALPATH to variable search_flags. * defs.h (OPF_DISABLE_REALPATH): Rename to ... (OPF_RETURN_REALPATH): ... here. * dwarf2read.c (try_open_dwop_file): Set OPF_RETURN_REALPATH for flags. * exec.c (exec_file_attach): Remove OPF_DISABLE_REALPATH from openp call. Twice. * nto-tdep.c (nto_find_and_open_solib): Add OPF_RETURN_REALPATH for openp call. * solib.c (solib_find): Likewise. Four times. * source.c (openp): Change OPF_DISABLE_REALPATH to OPF_RETURN_REALPATH in the function comment and for the realpath_fptr variable. (source_full_path_of): Add OPF_RETURN_REALPATH for openp call. (find_and_open_source): Likewise. Twice. * symfile.c (symfile_bfd_open): Likewise, also twice.
This commit is contained in:
23
gdb/source.c
23
gdb/source.c
@ -689,10 +689,10 @@ is_regular_file (const char *name)
|
||||
and the file, sigh! Emacs gets confuzzed by this when we print the
|
||||
source file name!!!
|
||||
|
||||
If OPTS does not have OPF_DISABLE_REALPATH set return FILENAME_OPENED
|
||||
resolved by gdb_realpath. Even with OPF_DISABLE_REALPATH this function
|
||||
still returns filename starting with "/". If FILENAME_OPENED is NULL
|
||||
this option has no effect.
|
||||
If OPTS has OPF_RETURN_REALPATH set return FILENAME_OPENED resolved by
|
||||
gdb_realpath. Even without OPF_RETURN_REALPATH this function still returns
|
||||
filename starting with "/". If FILENAME_OPENED is NULL this option has no
|
||||
effect.
|
||||
|
||||
If a file is found, return the descriptor.
|
||||
Otherwise, return -1, with errno set for the last name we tried to open. */
|
||||
@ -857,8 +857,8 @@ done:
|
||||
{
|
||||
char *(*realpath_fptr) (const char *);
|
||||
|
||||
realpath_fptr = ((opts & OPF_DISABLE_REALPATH) != 0
|
||||
? xstrdup : gdb_realpath);
|
||||
realpath_fptr = ((opts & OPF_RETURN_REALPATH) != 0
|
||||
? gdb_realpath : xstrdup);
|
||||
|
||||
if (IS_ABSOLUTE_PATH (filename))
|
||||
*filename_opened = realpath_fptr (filename);
|
||||
@ -897,8 +897,9 @@ 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, full_pathname);
|
||||
fd = openp (source_path,
|
||||
OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH,
|
||||
filename, O_RDONLY, full_pathname);
|
||||
if (fd < 0)
|
||||
{
|
||||
*full_pathname = NULL;
|
||||
@ -1077,13 +1078,15 @@ find_and_open_source (const char *filename,
|
||||
}
|
||||
}
|
||||
|
||||
result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, fullname);
|
||||
result = openp (path, OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH, 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, fullname);
|
||||
result = openp (path, OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH, p,
|
||||
OPEN_MODE, fullname);
|
||||
}
|
||||
|
||||
do_cleanups (cleanup);
|
||||
|
Reference in New Issue
Block a user