summaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-11-10 22:14:15 +0000
committerDoug Evans <dje@google.com>2011-11-10 22:14:15 +0000
commit05472f2f22e1db0255b5bb22e3e65991d8f88e25 (patch)
tree8e7a38ee5aae3ab710bcdeafeb52eea656a6c45c /gdb/psymtab.c
parent19f173f49a22850c424736e95bc45f76d62aa3c0 (diff)
downloadgdb-05472f2f22e1db0255b5bb22e3e65991d8f88e25.tar.gz
* psymtab.c (psymtab_to_fullname): Use cached copy if it exists.
* source.c (symtab_to_fullname): Ditto.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 1f3b3dc64c0..38adca2e227 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1110,6 +1110,7 @@ int find_and_open_source (const char *filename,
If this function fails to find the file that this partial_symtab represents,
NULL will be returned and ps->fullname will be set to NULL. */
+
static char *
psymtab_to_fullname (struct partial_symtab *ps)
{
@@ -1118,8 +1119,12 @@ psymtab_to_fullname (struct partial_symtab *ps)
if (!ps)
return NULL;
- /* Don't check ps->fullname here, the file could have been
- deleted/moved/..., look for it again. */
+ /* Use cached copy if we have it.
+ We rely on forget_cached_source_info being called appropriately
+ to handle cases like the file being moved. */
+ if (ps->fullname)
+ return ps->fullname;
+
r = find_and_open_source (ps->filename, ps->dirname, &ps->fullname);
if (r >= 0)