aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-11-10 22:14:16 +0000
committerDoug Evans <dje@google.com>2011-11-10 22:14:16 +0000
commit256f06f3f6f833a3ac2abd5fcb341399028cc03c (patch)
treea053fb7f100879aa02b7b17296a2661241afc8a8 /gdb/source.c
parent29ab395d2b246f993e8fd06f71a1fe165d2f3985 (diff)
downloadgdb-256f06f3f6f833a3ac2abd5fcb341399028cc03c.zip
gdb-256f06f3f6f833a3ac2abd5fcb341399028cc03c.tar.gz
gdb-256f06f3f6f833a3ac2abd5fcb341399028cc03c.tar.bz2
* psymtab.c (psymtab_to_fullname): Use cached copy if it exists.
* source.c (symtab_to_fullname): Ditto.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 6e29172..77df541 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1105,6 +1105,7 @@ open_source_file (struct symtab *s)
If this function fails to find the file that this symtab represents,
NULL will be returned and s->fullname will be set to NULL. */
+
char *
symtab_to_fullname (struct symtab *s)
{
@@ -1113,8 +1114,12 @@ symtab_to_fullname (struct symtab *s)
if (!s)
return NULL;
- /* Don't check s->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 (s->fullname)
+ return s->fullname;
+
r = find_and_open_source (s->filename, s->dirname, &s->fullname);
if (r >= 0)