aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-09-04 20:09:39 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-09-04 20:09:39 +0000
commit492c0ab72a050a19d09d0df16eb3b0d8da22be1a (patch)
treefe7dc9a2a9b6ad41a2bd663c1c6b951d115cc001 /gdb
parent23a44de8103159b27793ce556932619ed6cc6b01 (diff)
downloadgdb-492c0ab72a050a19d09d0df16eb3b0d8da22be1a.zip
gdb-492c0ab72a050a19d09d0df16eb3b0d8da22be1a.tar.gz
gdb-492c0ab72a050a19d09d0df16eb3b0d8da22be1a.tar.bz2
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog19
-rw-r--r--gdb/cli/cli-cmds.c2
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/dwarf2read.c2
-rw-r--r--gdb/exec.c7
-rw-r--r--gdb/nto-tdep.c3
-rw-r--r--gdb/solib.c14
-rw-r--r--gdb/source.c23
-rw-r--r--gdb/symfile.c6
9 files changed, 50 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d5244c6..bd7a8fb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+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.
+
2013-09-04 Doug Evans <dje@google.com>
* progspace.c (save_current_space_and_thread): Remove unnecessary
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 0649cbc..4317ea3 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -479,7 +479,7 @@ find_and_open_script (const char *script_file, int search_path,
char *file;
int fd;
struct cleanup *old_cleanups;
- int search_flags = OPF_TRY_CWD_FIRST;
+ int search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
file = tilde_expand (script_file);
old_cleanups = make_cleanup (xfree, file);
diff --git a/gdb/defs.h b/gdb/defs.h
index 2ea49f8..1e5521f 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -349,7 +349,7 @@ extern const char *pc_prefix (CORE_ADDR);
/* See openp function definition for their description. */
#define OPF_TRY_CWD_FIRST 0x01
#define OPF_SEARCH_IN_PATH 0x02
-#define OPF_DISABLE_REALPATH 0x04
+#define OPF_RETURN_REALPATH 0x04
extern int openp (const char *, int, const char *, int, char **);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 03b956a..59b7b01 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9349,7 +9349,7 @@ try_open_dwop_file (const char *file_name, int is_dwp, int search_cwd)
else
search_path = xstrdup (debug_file_directory);
- flags = 0;
+ flags = OPF_RETURN_REALPATH;
if (is_dwp)
flags |= OPF_SEARCH_IN_PATH;
desc = openp (search_path, flags, file_name,
diff --git a/gdb/exec.c b/gdb/exec.c
index c61d530..c7370e3 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -187,8 +187,7 @@ exec_file_attach (char *filename, int from_tty)
struct target_section *sections = NULL, *sections_end = NULL;
char **matching;
- scratch_chan = openp (getenv ("PATH"),
- OPF_TRY_CWD_FIRST | OPF_DISABLE_REALPATH, filename,
+ scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
&scratch_pathname);
#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
@@ -197,9 +196,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 | OPF_DISABLE_REALPATH,
- exename,
+ scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
&scratch_pathname);
}
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 69ab5ad..5ec746d 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -128,7 +128,8 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
arch_path);
base = lbasename (solib);
- ret = openp (buf, OPF_TRY_CWD_FIRST, base, o_flags, temp_pathname);
+ ret = openp (buf, OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, base, o_flags,
+ temp_pathname);
if (ret < 0 && base != solib)
{
xsnprintf (arch_path, arch_len, "/%s", solib);
diff --git a/gdb/solib.c b/gdb/solib.c
index fd26687..5456d6f 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -319,14 +319,16 @@ 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,
+ found_file = openp (solib_search_path,
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
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,
+ found_file = openp (solib_search_path,
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
target_lbasename (fskind, in_pathname),
O_RDONLY | O_BINARY, &temp_pathname);
@@ -339,16 +341,16 @@ solib_find (char *in_pathname, int *fd)
if (found_file < 0 && gdb_sysroot_is_empty)
found_file = openp (get_in_environ (current_inferior ()->environment,
"PATH"),
- OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
- &temp_pathname);
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, 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 (current_inferior ()->environment,
"LD_LIBRARY_PATH"),
- OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
- &temp_pathname);
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
+ O_RDONLY | O_BINARY, &temp_pathname);
*fd = found_file;
return temp_pathname;
diff --git a/gdb/source.c b/gdb/source.c
index de3fb7c..9fa99b4 100644
--- a/gdb/source.c
+++ b/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);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 67206cd..9005e19 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1679,7 +1679,7 @@ symfile_bfd_open (char *name)
name = tilde_expand (name); /* Returns 1st new malloc'd copy. */
/* Look down path for it, allocate 2nd new malloc'd copy. */
- desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, name,
+ desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, name,
O_RDONLY | O_BINARY, &absolute_name);
#if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__)
if (desc < 0)
@@ -1687,8 +1687,8 @@ symfile_bfd_open (char *name)
char *exename = alloca (strlen (name) + 5);
strcat (strcpy (exename, name), ".exe");
- desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
- O_RDONLY | O_BINARY, &absolute_name);
+ desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
+ exename, O_RDONLY | O_BINARY, &absolute_name);
}
#endif
if (desc < 0)