Commit e003ca80 by Jeff Law

dbxout.c (dbxout_type_fields): Use HOST_WIDE_INT_PRINT_DEC appropriately.

d
        * dbxout.c (dbxout_type_fields): Use HOST_WIDE_INT_PRINT_DEC
        appropriately.
        (dbxout_type_method_1, dbxout_type): Likewise.
        (print_int_cst_octal, print_octal, dbxout_symbol): Likewise.
        (dbxout_type): Fix check for when to print a type range in
        octal vs decimal.

From-SVN: r19402
parent 442f4018
...@@ -662,8 +662,10 @@ dbxout_type_fields (type) ...@@ -662,8 +662,10 @@ dbxout_type_fields (type)
dbxout_type (DECL_FCONTEXT (tem), 0, 0); dbxout_type (DECL_FCONTEXT (tem), 0, 0);
fprintf (asmfile, ":"); fprintf (asmfile, ":");
dbxout_type (TREE_TYPE (tem), 0, 0); dbxout_type (TREE_TYPE (tem), 0, 0);
fprintf (asmfile, ",%d;", fputc (',', asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem))); TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
fputc (';', asmfile);
continue; continue;
} }
...@@ -712,9 +714,13 @@ dbxout_type_fields (type) ...@@ -712,9 +714,13 @@ dbxout_type_fields (type)
} }
else if (TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST) else if (TREE_CODE (DECL_FIELD_BITPOS (tem)) == INTEGER_CST)
{ {
fprintf (asmfile, ",%d,%d;", fputc (',', asmfile);
TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)), fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (DECL_FIELD_BITPOS (tem)));
fputc (',', asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (DECL_SIZE (tem))); TREE_INT_CST_LOW (DECL_SIZE (tem)));
fputc (';', asmfile);
} }
CHARS (23); CHARS (23);
} }
...@@ -759,8 +765,9 @@ dbxout_type_method_1 (decl, debug_name) ...@@ -759,8 +765,9 @@ dbxout_type_method_1 (decl, debug_name)
- (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)))); - (debug_name - IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))));
if (DECL_VINDEX (decl)) if (DECL_VINDEX (decl))
{ {
fprintf (asmfile, "%d;", fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (DECL_VINDEX (decl))); TREE_INT_CST_LOW (DECL_VINDEX (decl)));
fputc (';', asmfile);
dbxout_type (DECL_CONTEXT (decl), 0, 0); dbxout_type (DECL_CONTEXT (decl), 0, 0);
fprintf (asmfile, ";"); fprintf (asmfile, ";");
CHARS (8); CHARS (8);
...@@ -1128,9 +1135,12 @@ dbxout_type (type, full, show_arg_types) ...@@ -1128,9 +1135,12 @@ dbxout_type (type, full, show_arg_types)
dbxout_type_index (type); dbxout_type_index (type);
fprintf (asmfile, ";0;127;"); fprintf (asmfile, ";0;127;");
} }
/* This used to check if the type's precision was more than
HOST_BITS_PER_WIDE_INT. That is wrong since gdb uses a
long (it has no concept of HOST_BITS_PER_WIDE_INT). */
else if (use_gnu_debug_info_extensions else if (use_gnu_debug_info_extensions
&& (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node) && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
|| TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT)) || TYPE_PRECISION (type) > HOST_BITS_PER_LONG))
{ {
/* This used to say `r1' and we used to take care /* This used to say `r1' and we used to take care
to make sure that `int' was type number 1. */ to make sure that `int' was type number 1. */
...@@ -1152,14 +1162,20 @@ dbxout_type (type, full, show_arg_types) ...@@ -1152,14 +1162,20 @@ dbxout_type (type, full, show_arg_types)
to make sure that `int' was type number 1. */ to make sure that `int' was type number 1. */
fprintf (asmfile, "r"); fprintf (asmfile, "r");
dbxout_type_index (integer_type_node); dbxout_type_index (integer_type_node);
fprintf (asmfile, ";%d;0;", int_size_in_bytes (type)); fputc (';', asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (type));
fputs (";0;", asmfile);
CHARS (13); CHARS (13);
break; break;
case CHAR_TYPE: case CHAR_TYPE:
if (use_gnu_debug_info_extensions) if (use_gnu_debug_info_extensions)
fprintf (asmfile, "@s%d;-20;", {
BITS_PER_UNIT * int_size_in_bytes (type)); fputs ("@s", asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
BITS_PER_UNIT * int_size_in_bytes (type));
fputs (";-20;", asmfile);
}
else else
{ {
/* Output the type `char' as a subrange of itself. /* Output the type `char' as a subrange of itself.
...@@ -1173,8 +1189,12 @@ dbxout_type (type, full, show_arg_types) ...@@ -1173,8 +1189,12 @@ dbxout_type (type, full, show_arg_types)
case BOOLEAN_TYPE: case BOOLEAN_TYPE:
if (use_gnu_debug_info_extensions) if (use_gnu_debug_info_extensions)
fprintf (asmfile, "@s%d;-16;", {
BITS_PER_UNIT * int_size_in_bytes (type)); fputs ("@s", asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
BITS_PER_UNIT * int_size_in_bytes (type));
fputs (";-16;", asmfile);
}
else /* Define as enumeral type (False, True) */ else /* Define as enumeral type (False, True) */
fprintf (asmfile, "eFalse:0,True:1,;"); fprintf (asmfile, "eFalse:0,True:1,;");
CHARS (17); CHARS (17);
...@@ -1193,15 +1213,18 @@ dbxout_type (type, full, show_arg_types) ...@@ -1193,15 +1213,18 @@ dbxout_type (type, full, show_arg_types)
{ {
fprintf (asmfile, "r"); fprintf (asmfile, "r");
dbxout_type_index (type); dbxout_type_index (type);
fprintf (asmfile, ";%d;0;", fputc (';', asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
int_size_in_bytes (TREE_TYPE (type))); int_size_in_bytes (TREE_TYPE (type)));
fputs (";0;", asmfile);
CHARS (12); /* The number is probably incorrect here. */ CHARS (12); /* The number is probably incorrect here. */
} }
else else
{ {
/* Output a complex integer type as a structure, /* Output a complex integer type as a structure,
pending some other way to do it. */ pending some other way to do it. */
fprintf (asmfile, "s%d", int_size_in_bytes (type)); fputc ('s', asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (type));
fprintf (asmfile, "real:"); fprintf (asmfile, "real:");
CHARS (10); CHARS (10);
...@@ -1223,8 +1246,10 @@ dbxout_type (type, full, show_arg_types) ...@@ -1223,8 +1246,10 @@ dbxout_type (type, full, show_arg_types)
if (use_gnu_debug_info_extensions) if (use_gnu_debug_info_extensions)
{ {
have_used_extensions = 1; have_used_extensions = 1;
fprintf (asmfile, "@s%d;", fputs ("@s", asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
BITS_PER_UNIT * int_size_in_bytes (type)); BITS_PER_UNIT * int_size_in_bytes (type));
fputc (';', asmfile);
/* Check if a bitstring type, which in Chill is /* Check if a bitstring type, which in Chill is
different from a [power]set. */ different from a [power]set. */
if (TYPE_STRING_FLAG (type)) if (TYPE_STRING_FLAG (type))
...@@ -1310,7 +1335,8 @@ dbxout_type (type, full, show_arg_types) ...@@ -1310,7 +1335,8 @@ dbxout_type (type, full, show_arg_types)
} }
/* Identify record or union, and print its size. */ /* Identify record or union, and print its size. */
fprintf (asmfile, (TREE_CODE (type) == RECORD_TYPE) ? "s%d" : "u%d", fputc (((TREE_CODE (type) == RECORD_TYPE) ? 's' : 'u'), asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
int_size_in_bytes (type)); int_size_in_bytes (type));
if (use_gnu_debug_info_extensions) if (use_gnu_debug_info_extensions)
...@@ -1334,8 +1360,9 @@ dbxout_type (type, full, show_arg_types) ...@@ -1334,8 +1360,9 @@ dbxout_type (type, full, show_arg_types)
putc (TREE_VIA_PUBLIC (child) ? '2' putc (TREE_VIA_PUBLIC (child) ? '2'
: '0', : '0',
asmfile); asmfile);
fprintf (asmfile, "%d,", fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT); TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
fputc (',', asmfile);
CHARS (15); CHARS (15);
dbxout_type (BINFO_TYPE (child), 0, 0); dbxout_type (BINFO_TYPE (child), 0, 0);
putc (';', asmfile); putc (';', asmfile);
...@@ -1347,9 +1374,13 @@ dbxout_type (type, full, show_arg_types) ...@@ -1347,9 +1374,13 @@ dbxout_type (type, full, show_arg_types)
dbxout_type_name (BINFO_TYPE (child)); dbxout_type_name (BINFO_TYPE (child));
putc (':', asmfile); putc (':', asmfile);
dbxout_type (BINFO_TYPE (child), full, 0); dbxout_type (BINFO_TYPE (child), full, 0);
fprintf (asmfile, ",%d,%d;", fputc (',', asmfile);
TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT, fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (BINFO_OFFSET (child)) * BITS_PER_UNIT);
fputc (',', asmfile);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (DECL_SIZE (TYPE_NAME (BINFO_TYPE (child)))) * BITS_PER_UNIT); TREE_INT_CST_LOW (DECL_SIZE (TYPE_NAME (BINFO_TYPE (child)))) * BITS_PER_UNIT);
fputc (';', asmfile);
CHARS (20); CHARS (20);
} }
} }
...@@ -1418,12 +1449,12 @@ dbxout_type (type, full, show_arg_types) ...@@ -1418,12 +1449,12 @@ dbxout_type (type, full, show_arg_types)
{ {
fprintf (asmfile, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem))); fprintf (asmfile, "%s:", IDENTIFIER_POINTER (TREE_PURPOSE (tem)));
if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == 0) if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == 0)
fprintf (asmfile, "%lu", fprintf (asmfile, HOST_WIDE_INT_PRINT_UNSIGNED,
(unsigned long) TREE_INT_CST_LOW (TREE_VALUE (tem))); TREE_INT_CST_LOW (TREE_VALUE (tem)));
else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1 else if (TREE_INT_CST_HIGH (TREE_VALUE (tem)) == -1
&& TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0) && TREE_INT_CST_LOW (TREE_VALUE (tem)) < 0)
fprintf (asmfile, "%ld", fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC,
(long) TREE_INT_CST_LOW (TREE_VALUE (tem))); TREE_INT_CST_LOW (TREE_VALUE (tem)));
else else
print_int_cst_octal (TREE_VALUE (tem)); print_int_cst_octal (TREE_VALUE (tem));
fprintf (asmfile, ","); fprintf (asmfile, ",");
...@@ -1560,7 +1591,7 @@ print_int_cst_octal (c) ...@@ -1560,7 +1591,7 @@ print_int_cst_octal (c)
<< (HOST_BITS_PER_WIDE_INT / 3 * 3)) << (HOST_BITS_PER_WIDE_INT / 3 * 3))
- 1); - 1);
fprintf (asmfile, "%o%01o", beg, middle); fprintf (asmfile, "%o%01o", (int)beg, (int)middle);
print_octal (end, HOST_BITS_PER_WIDE_INT / 3); print_octal (end, HOST_BITS_PER_WIDE_INT / 3);
} }
} }
...@@ -1573,7 +1604,7 @@ print_octal (value, digits) ...@@ -1573,7 +1604,7 @@ print_octal (value, digits)
int i; int i;
for (i = digits - 1; i >= 0; i--) for (i = digits - 1; i >= 0; i--)
fprintf (asmfile, "%01o", ((value >> (3 * i)) & 7)); fprintf (asmfile, "%01o", (int)((value >> (3 * i)) & 7));
} }
/* Output the name of type TYPE, with no punctuation. /* Output the name of type TYPE, with no punctuation.
...@@ -1853,8 +1884,10 @@ dbxout_symbol (decl, local) ...@@ -1853,8 +1884,10 @@ dbxout_symbol (decl, local)
#ifdef DBX_OUTPUT_CONSTANT_SYMBOL #ifdef DBX_OUTPUT_CONSTANT_SYMBOL
DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival); DBX_OUTPUT_CONSTANT_SYMBOL (asmfile, name, ival);
#else #else
fprintf (asmfile, "%s \"%s:c=i%d\",0x%x,0,0,0\n", fprintf (asmfile, "%s \"%s:c=i", ASM_STABS_OP, name);
ASM_STABS_OP, name, ival, N_LSYM);
fprintf (asmfile, HOST_WIDE_INT_PRINT_DEC, ival);
fprintf (asmfile, "\",0x%x,0,0,0\n", N_LSYM);
#endif #endif
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment