[D] Support looking up symbols in the current and imported modules.

In D, there is the notion of modules, and importing from one to the other,
whether it is a basic, selective or renamed import declaration.

	module A;
	import X;
	void foo() {
	  import Y : bar;
	}

If the compiler emits DW_TAG_imported_declaration at the appropriate locations,
then we can make use of what gdb stores in using_direct when performing
nonlocal symbol lookups.

gdb/ChangeLog

	* Makefile.in (SFILES): Add d-namespace.c.
	(COMMON_OBS): Add d-namespace.o.
	* d-lang.c (d_language_defn): Use d_lookup_symbol_nonlocal as the
	la_lookup_symbol_nonlocal callback function pointer.
	* d-lang.h (d_lookup_symbol_nonlocal): New declaration.
	(d_lookup_nested_symbol): New declaration.
	* d-namespace.c: New file.
This commit is contained in:
Iain Buclaw
2015-08-13 20:34:15 +02:00
parent 52bbc56052
commit bc7c9fab61
5 changed files with 585 additions and 3 deletions

View File

@ -214,7 +214,7 @@ static const struct language_defn d_language_defn =
default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline. */
"this",
basic_lookup_symbol_nonlocal,
d_lookup_symbol_nonlocal,
basic_lookup_transparent_type,
d_demangle, /* Language specific symbol demangler. */
NULL, /* Language specific