+ testsuite/
+ * gdb.python/python.exp: Add test for symlink from .py file to .notpy
+ file.
+--- README.google 2015-09-15 16:23:33.000000000 -0700
++++ README.google 2015-09-15 16:26:22.000000000 -0700
++
++2015-09-15 Doug Evans <dje@google.com>
++
++ Ref# 23817600
++ * dwarf2read.c (dw2_get_real_path): Call canonicalize_source_path
++ instead of gdb_realpath.
++ * symtab.c (iterate_over_symtabs): Ditto.
++ * source.c (canonicalize_source_paths): New static global.
++ (source_full_path_of): Only pass OPF_RETURN_REALPATH to openp if
++ canonicalize_source_paths.
++ (find_and_open_source): Ditto. Call canonicalize_source_path.
++ (canonicalize_source_path): New function.
++ (_initialize_source): New parameter "canonicalize-source-paths".
++ * source.h (canonicalize_source_path): Declare.
static void source_info (char *, int);
+/* GOOGLE LOCAL ref# 23817600 */
+/* Non-zero if source file paths should be canonicalized (realpath'd). */
+
+static int canonicalize_source_paths = 1;
+
/* Path of directories to search for source files.
Same format as the PATH environment variable's value. */
int fd;
fd = openp (source_path,
- OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH,
+ (OPF_TRY_CWD_FIRST | OPF_SEARCH_IN_PATH
+ /* GOOGLE LOCAL ref# 23817600 */
+ | (canonicalize_source_paths ? OPF_RETURN_REALPATH : 0)),
filename, O_RDONLY, full_pathname);
if (fd < 0)
{
result = gdb_open_cloexec (*fullname, OPEN_MODE, 0);
if (result >= 0)
{
- char *lpath = gdb_realpath (*fullname);
+ /* GOOGLE LOCAL ref# 23817600 */
+ char *lpath = canonicalize_source_path (*fullname);
xfree (*fullname);
*fullname = lpath;
}
}
- result = openp (path, OPF_SEARCH_IN_PATH | OPF_RETURN_REALPATH, filename,
- OPEN_MODE, fullname);
+ /* GOOGLE LOCAL ref# 23817600 */
+ result = openp (path,
+ (OPF_SEARCH_IN_PATH
+ | (canonicalize_source_paths ? OPF_RETURN_REALPATH : 0)),
+ 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 | OPF_RETURN_REALPATH, p,
- OPEN_MODE, fullname);
+ result = openp (path,
+ /* GOOGLE LOCAL ref# 23817600 */
+ (OPF_SEARCH_IN_PATH
+ | (canonicalize_source_paths
+ ? OPF_RETURN_REALPATH : 0)),
+ p, OPEN_MODE, fullname);
}
do_cleanups (cleanup);
do_cleanups (cleanup);
}
+/* GOOGLE LOCAL ref# 23817600 */
+/* See source.h. */
+
+char *
+canonicalize_source_path (const char *source_path)
+{
+ if (canonicalize_source_paths)
+ return gdb_realpath (source_path);
+ return gdb_abspath (source_path);
+}
\f
void
_initialize_source (void)
show_filename_display_string,
&setlist, &showlist);
+ /* GOOGLE LOCAL ref# 23817600 */
+ add_setshow_boolean_cmd ("canonicalize-source-paths", class_obscure,
+ &canonicalize_source_paths, _("\
+Set whether source file paths are canonicalized."), _("\
+Show whether source file paths are canonicalized."), _("\
+If set, GDB will canonicalize all source paths (e.g., expand symlinks)."),
+ NULL, NULL,
+ &setlist, &showlist);
}
/* Add a source path substitution rule. */
extern void add_substitute_path_rule (char *, char *);
+
+/* GOOGLE LOCAL ref# 23817600 */
+/* Return the possibly canonicalized version of SOURCE_PATH.
+ Whether to do so is controlled by the "canonicalize-source-paths"
+ parameter. The result is always an absolute path.
+ Space for the result is always malloc'd, caller must free. */
+extern char *canonicalize_source_path (const char *source_path);
+
#endif