DWARF output, type of char[]?

BCS BCS at pathlink.com
Tue Apr 3 09:20:39 PDT 2007


Cristian Vlasceanu wrote:
> BCS Wrote:
> 
> 
>>Reply to Cristian,
>>
>>
>>>What is the DWARF type of char[], as output by the DMD backend?
>>
>>The expression that gets the content of a char[] 
>>as something gdb can read is several inches long.
>>
> 
> I am not sure that I understand this? Is there is a way of transforming the unsigned long long into something meaningful?
> 

yes

given T[] arr;

the contents are:  *(cast(T*)(cast(void*)(&arr)[1])
the length is:  *cast(size_t*)(&arr)

and that's if I remember correctly. It's ugly and messy and a total pain 
in the whatever. But it works.

However if an array of type T[] were to claim to be

struct
{
	T* ptr;
	size_t length;
}

or something close to that, then you could access it almost as normal.


> Zero treats all types as if the source were C/C++.
> 
> I am working on allowing the user to customize the way variables are being displayed (via Python scripts). I am doing it mainly for being able to display C++/STL containers in a sane way, but I think that with a little work it may do the trick for D types as well.
> 
>    Cristian


More information about the Digitalmars-d-debugger mailing list