aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2016-02-28 10:25:55 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2016-02-28 16:11:26 +0100
commit38899f16e1560ce3020bab8a6a0b3a0c017d7925 (patch)
tree1c6cdd7f6f0262d40d27faff8a1270809f68eb26 /gdb/d-namespace.c
parentAutomatic date update in version.in (diff)
downloadbinutils-gdb-38899f16e1560ce3020bab8a6a0b3a0c017d7925.tar.gz
binutils-gdb-38899f16e1560ce3020bab8a6a0b3a0c017d7925.tar.bz2
binutils-gdb-38899f16e1560ce3020bab8a6a0b3a0c017d7925.zip
Don't recursively look for a symbol in all imports of imported modules.
Given two or more modules that import each other's scope, the current symbol lookup routines would go round in circles looking through each import from each module, possibly checking the same module twice or more until all possible paths are marked as "searched". Given enough modules, this causes an exponential slowdown in time taken to find symbols that do exist, and infinite recursion when they don't. gdb/ChangeLog: * d-namespace.c (d_lookup_symbol_imports): Avoid recursive lookups from cyclic imports. gdb/testsuite/ChangeLog: * gdb.dlang/circular.c: New file. * gdb.dlang/circular.exp: New file.
Diffstat (limited to 'gdb/d-namespace.c')
-rw-r--r--gdb/d-namespace.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index 6399ef012f3..8b8c3cc96c7 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -483,9 +483,9 @@ d_lookup_symbol_imports (const char *scope, const char *name,
{
/* Skip the '.' */
name_scope++;
- sym = d_lookup_symbol_imports (current->import_src,
- name + name_scope,
- block, domain);
+ sym = d_lookup_symbol_in_module (current->import_src,
+ name + name_scope,
+ block, domain, 1);
}
}
}
@@ -494,8 +494,8 @@ d_lookup_symbol_imports (const char *scope, const char *name,
/* If this import statement creates no alias, pass
current->import_src as MODULE to direct the search
towards the imported module. */
- sym = d_lookup_symbol_imports (current->import_src,
- name, block, domain);
+ sym = d_lookup_symbol_in_module (current->import_src,
+ name, block, domain, 1);
}
current->searched = 0;
discard_cleanups (searched_cleanup);