mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-01 20:12:01 +08:00
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.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user