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

Don Clugston dac at nospam.com.au
Thu Nov 23 00:35:20 PST 2006


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.
- The bug with local alias template parameters (depends on where it's 
instantiated from).
- Bugzilla bug #221, a one-character fix.
mtype.c line 174-175,

     mangleChar[Tbit] = 'b';
     mangleChar[Tbool] = 'x';

This should be changed so they are both 'b'.
- 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

for

void main()
{
   int abc;
}


making it distinguishable from
extern(Windows)
{
   int main3abci;
}

- template floating point value parameters should use big-endian order 
(with exponent first) which would be moderately human-readable, instead 
of the current order, which makes no sense.

expression.c line 1316 is currently

     for (int i = 0; i < REALSIZE-REALPAD; i++)
	buf->printf("%02x", p[i]);

but should be

     for (int i = REALSIZE-REALPAD-1; i >=0; i--)
	buf->printf("%02x", p[i]);

(Actually it would be even better if the implicit bit were stripped out 
for x86; that would make it more compatible across platforms, and would 
mean 0x1.123456789ABCDEDEp+0 would be mangled as:
"3FFF123456789ABCDEDE"
-- but proper cross-platform support needs a bit more thought).



More information about the Digitalmars-d-announce mailing list