[PATCH] D: Support looking up symbols in the current and imported modules
Iain Buclaw
ibuclaw@gdcproject.org
Tue Jul 14 09:05:00 GMT 2015
Hi,
D has the notion of importing modules, whether it is public, private,
or static; basic, selective, or renamed.
This adds support for looking up symbols in both the current and
imported modules so that it is not a necessity to use the qualified
name every time.
Example:
module A;
import B; // Basic import
import R = C; // Renamed import
import D : funD; // Selective import
import E : funR = funE; // Renamed selective import
void funA()
{
// <- Breakpoint here
}
>From the given breakpoint, the following should work in:
- All symbols in module 'A' (our current module) can be looked up by name.
- All symbols in module 'B' can be looked up by name.
- All symbols in module 'C' can be looked up through it's alias R.name.
- Only 'funD' in module 'D' can be looked up by name.
- Only 'funE' in module 'E' can be looked up through it's alias 'funR'.
- All fully qualified symbol names can be looked up.
The implementation of this itself is mostly borrowed from
cp-namespace.c, but differs in the follow ways:
- The separator for modules is a single dot '.'
- Renamed selective imports need special handling for D.
This has a dependency on dwarf2read.c being able to handle language_d
when reading/parsing module/imported declaration symbols, which has
been raised as a separate patch.
Regards
Iain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlang-namespace.patch
Type: text/x-diff
Size: 19926 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20150714/64a732df/attachment.bin>
More information about the Gdb-patches
mailing list