For various reasons I am working on some automated analysis tools that parse the DWARF debug info in a .out file. I will be using these tools for a variety of processors including MSP430 and C2000 DSPs.
I have been frequently referring to SPRAAB5 as well as the DWARF 2.0 standard and have gotten all the information I need with the exception of memory architecture parameters like:
1) how many bits are in a memory word (e.g. 8 for MSP430, 16 for C2000)
2) whether a multi-word variable is stored little-endian or big-endian
3) inherent range of values (e.g. char stored in 16-bit word for C2000)
How can I get this information from the .out file?
Here's what I get for base types with my software tool from the DWARF info (columns = DW_AT_byte_size attribute, name, then DW_AT_encoding attribute)
MSP430: (MSP430F248 in this case)
1 bool [DW_ATE_boolean]
1 signed char [DW_ATE_signed_char]
1 unsigned char [DW_ATE_unsigned_char]
2 wchar_t [DW_ATE_signed_char]
2 short [DW_ATE_signed]
2 unsigned short [DW_ATE_unsigned]
2 int [DW_ATE_signed]
2 unsigned int [DW_ATE_unsigned]
4 long [DW_ATE_signed]
4 unsigned long [DW_ATE_unsigned]
4 long long [DW_ATE_signed]
4 unsigned long long [DW_ATE_unsigned]
4 float [DW_ATE_float]
4 double [DW_ATE_float]
4 long double [DW_ATE_float]
C2000: (TMS320F28335 in this case)
1 bool [DW_ATE_boolean]
1 signed char [DW_ATE_signed_char]
1 unsigned char [DW_ATE_unsigned_char]
1 wchar_t [DW_ATE_signed_char]
1 short [DW_ATE_signed]
1 unsigned short [DW_ATE_unsigned]
1 int [DW_ATE_signed]
1 unsigned int [DW_ATE_unsigned]
2 long [DW_ATE_signed]
2 unsigned long [DW_ATE_unsigned]
4 long long [DW_ATE_signed]
4 unsigned long long [DW_ATE_unsigned]
2 float [DW_ATE_float]
2 double [DW_ATE_float]
4 long double [DW_ATE_float]
The DW_AT_byte_size attribute seems to be used by the TI compiler to store the word size, not the byte size, despite the fact that the Dwarf standard says this (end of section 5.1)
For example, the C type int on a machine that uses 32-bit integers would be represented by a base type entry with a name attribute whose value was ‘‘int,’’ an encoding attribute whose value was DW_ATE_signed and a byte size attribute whose value was 4.
On the C2000, a "long" is a 32-bit integer, but its "byte size" is stored in the DWARF file as 2, not 4. (words rather than bytes) Is this use of DW_AT_byte_size documented somewhere? (If not, it should be added to a new revision of SPRAAB5)