+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
 
   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);
 
 /* 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 **);
 
 
   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,
 
       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__)
          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);
        }
 
             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);
 
 
   /* 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);
 
   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;
 
    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.  */
        {
          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);
 {
   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;
         }
     }
 
-  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);
 
   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)
       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)