A new debugger for Linux - would it work for D?

Don Clugston dac at nospam.com.au
Thu Nov 23 23:18:03 PST 2006


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Don Clugston schrieb am 2006-11-23:
>> Walter Bright wrote:
>>> Don Clugston wrote:
>>>> Thomas K�hne wrote:
>>>>> Cristian Vlasceanu wrote:
>>>>>> D has a demangling scheme that is not compatible with C++?
>>>>>> Then that's another area that needs work in the debugger.
>>>>> see attachment
>>>>>
>>>>> Thomas
>>>> Wow, it's interesting to compare yours with my compile-time demangler. 
>>>> They are both about the same number of lines of code (and both seem 
>>>> more comprehensive than the one in Phobos).
>>> Would you two care to take the best of both, and we can replace the 
>>> Phobos one?
>> I think there a couple of issues in the mangling algorithm which need to 
>> be addressed first.
> 
> <snip>
> 
>> - Items that use D mangling but don't have D linkage. I suggest changing 
>> those cases to use "0" then the linkage type ('W' for Windows, 'U', for 
>> C, etc, same as for delegate/function pointers), then the length.
>> So instead of
>> main3abci
>>
>> it would be
>> 0U4main3abci
> 
> I dislike unnecessary special cases:
> #
> # module wood;
> # 
> # class Tree{
> #    static this(){
> #    }
> # 
> #    ~this(){
> #    }
> # }
> # 
> # extern(C) void outer(){
> #    extern(Windows) int middle(){
> #       void inner(){
> #       }
> #       return 0;
> #    }
> # }
> # 
> 
> DMD-0.174 generates the following symbols
> (special cases are marked by an asterisk):
>> _Class_4wood4Tree *
>> _D4wood4Tree11_staticCtorFZv
>> _D4wood4Tree5_dtorFZv
>> _init_4wood4Tree *
>> _modctor_4wood *
>> outer
>> outer6middleWZi *
>> outer6middleWZi5innerFZv *
>> _vtbl_4wood4Tree *
> 
> I propose the following mangling:
>> _D4wood4Tree9__Class__Pv
>> _D4wood4Tree12__staticCtorFZv
>> _D4wood4Tree6__dtorFZv
>> _D4wood4Tree8__init__Pv
>> _D4wood11__modctor__FZv
>> outer
>> _D4wood5outerFZv6middleWZi
>> _D4wood5outerFZv6middleWZi5innerFZv
>> _D4wood4Tree8__vtbl__Av
> 
> There are no special cases(identifiers starting with two underscores are
> reserved), thus no need for the demangler to know anything about the RT's
> internals.

Agreed, I like that *much* better than my proposal.
BTW, unittest is another special case, and should be treated in the same 
way.
- Don.



More information about the Digitalmars-d-announce mailing list