summaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2013-08-28 17:52:03 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2013-08-28 17:52:03 +0000
commit1f0c498857f8ece90893be592ee2e4f967a6d999 (patch)
tree92f1b9e8ca3fbcbc7fc0f0376ef8cb839393978c /gdb/source.c
parent602e3198bc03297b7d9cb34ed3838272254eba1f (diff)
PR gdb/15415
gdb/ 2013-08-27 Jan Kratochvil <jan.kratochvil@redhat.com> PR gdb/15415 * corefile.c (get_exec_file): Use exec_filename. * defs.h (OPF_DISABLE_REALPATH): New definition. Add new comment. * exec.c (exec_close): Free EXEC_FILENAME. (exec_file_attach): New variable canonical_pathname. Use OPF_DISABLE_REALPATH. Call gdb_realpath explicitly. Set EXEC_FILENAME. * exec.h (exec_filename): New. * inferior.c (print_inferior, inferior_command): Use PSPACE_EXEC_FILENAME. * mi/mi-main.c (print_one_inferior): Likewise. * progspace.c (clone_program_space, print_program_space): Likewise. * progspace.h (struct program_space): New field pspace_exec_filename. * source.c (openp): Describe OPF_DISABLE_REALPATH. New variable realpath_fptr, initialize it from OPF_DISABLE_REALPATH, use it. gdb/testsuite/ 2013-08-27 Jan Kratochvil <jan.kratochvil@redhat.com> PR gdb/15415 * gdb.base/argv0-symlink.c: New file. * gdb.base/argv0-symlink.exp: New file.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/gdb/source.c b/gdb/source.c
index e1c498bf18..de3fb7c5a3 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -689,6 +689,11 @@ 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 a file is found, return the descriptor.
Otherwise, return -1, with errno set for the last name we tried to open. */
@@ -848,19 +853,27 @@ done:
/* If a file was opened, canonicalize its filename. */
if (fd < 0)
*filename_opened = NULL;
- else if (IS_ABSOLUTE_PATH (filename))
- *filename_opened = gdb_realpath (filename);
else
{
- /* Beware the // my son, the Emacs barfs, the botch that catch... */
+ char *(*realpath_fptr) (const char *);
+
+ realpath_fptr = ((opts & OPF_DISABLE_REALPATH) != 0
+ ? xstrdup : gdb_realpath);
+
+ if (IS_ABSOLUTE_PATH (filename))
+ *filename_opened = realpath_fptr (filename);
+ else
+ {
+ /* Beware the // my son, the Emacs barfs, the botch that catch... */
- char *f = concat (current_directory,
- IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])
- ? "" : SLASH_STRING,
- filename, (char *)NULL);
+ char *f = concat (current_directory,
+ IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])
+ ? "" : SLASH_STRING,
+ filename, (char *)NULL);
- *filename_opened = gdb_realpath (f);
- xfree (f);
+ *filename_opened = realpath_fptr (f);
+ xfree (f);
+ }
}
}