Bug in Dwarf format for fixed point data types?

Fu, Chao-Ying fu@mips.com
Fri Oct 19 21:43:00 GMT 2007


Mohamed Shafi wrote:
> 
> Hello sir,
> 
> I have implemented fixed-point support for a private target in
> gcc-4.1.1 based on the fixed point patches given on the gcc mailing
> list for gcc 4.3.
> 
> For a sample test case, in the dwarf info generated, DW_AT_encoding
> tag set to 13 or 14 depending if they are unsigned or signed fxp data
> types.
> 
> As per the Dwarf3 manual, DW_AT_encoding tag should be set to 13 for
> signed types and 14 for unsigned types. But as of now these
> information is getting reversed because of the code given below.
> 
> Bug Code:
> File                 : dwarf2out.c
> Function Name: static dw_die_ref base_type_die (tree type)
> Line no           : 8435
> 
> case FIXED_POINT_TYPE:
>       if (TYPE_UNSIGNED (type))
> 	encoding = DW_ATE_signed_fixed;
>       else
> 	encoding = DW_ATE_unsigned_fixed;
>       break;

  Thanks for finding this bug!

> Another issue:
> After making the modification to the above code, the DW_AT_encoding is
> set properly. But we get "(unknown type)" instead of getting
> signed/unsigned. Is the behavior same in 4.3 or is it that the
> signedness information is dumped only for base data types?
> 
> <1><a0>: Abbrev Number: 4 (DW_TAG_base_type)
>     DW_AT_name        : short __accum
>     DW_AT_byte_size   : 2
>     DW_AT_encoding    : 13     (unknown type)
> <1><b1>: Abbrev Number: 4 (DW_TAG_base_type)
>     DW_AT_name        : unsigned short __accum
>     DW_AT_byte_size   : 2
>     DW_AT_encoding    : 14     (unknown type)
> <1><cb>: Abbrev Number: 4 (DW_TAG_base_type)
>     DW_AT_name        : int
>     DW_AT_byte_size   : 4
>     DW_AT_encoding    : 5      (signed)

  This may be due to code in src/binutils/dwarf.c

    case DW_AT_encoding:
...
        default:
          if (uvalue >= DW_ATE_lo_user
              && uvalue <= DW_ATE_hi_user)
            printf ("(user defined type)");
          else
            printf ("(unknown type)");
          break;

  To debug fixed-point types, we may need other info as follows.
DW_AT_binary_scale : binary scale factor for fixed-point type.
DW_AT_digit_count : digit count for packed decimal or numeric string type.

  However, these two are not generated by GCC.  Moreover, Binutils and
GDB haven't been updated to support fixed-point types.
So, more work needs to be done to fully support fixed-point types.
Thanks!

Regards,
Chao-ying



More information about the Gcc-patches mailing list