This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] binary_scale dwarf output for debugging fixed point modes
- From: "Sean D'Epagnier" <geckosenator at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Dec 2008 17:21:39 -0500
- Subject: [patch] binary_scale dwarf output for debugging fixed point modes
Hi,
This simple patch adds support to output binary_scale attributes for
dwarf output so gdb can debug fixed point numbers. I have a related
patch I am submitting to gdb which is needed for it to read this
attribute and correctly manipulate fixed-point values.
Let me know if there is anything else I need to do to get it applied.
Thanks
Sean
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 142945)
+++ gcc/dwarf2out.c (working copy)
@@ -9344,6 +9344,12 @@
add_AT_unsigned (base_type_result, DW_AT_byte_size,
int_size_in_bytes (type));
+
+ /* version 3 dwarf specifies that for fixed-point types DW_AT_binary_scale
+ describes the location of the decimal place */
+ if (TREE_CODE (type) == FIXED_POINT_TYPE)
+ add_AT_int (base_type_result, DW_AT_binary_scale, -TYPE_FBIT (type));
+
add_AT_unsigned (base_type_result, DW_AT_encoding, encoding);
return base_type_result;