comparison gcc/dbxout.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents 855418dad1a3
children f6334be47118
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
1 /* Output dbx-format symbol table information from GNU compiler. 1 /* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
169 the definition of the type. TYPE_XREF says we have 169 the definition of the type. TYPE_XREF says we have
170 output it as a cross-reference only. 170 output it as a cross-reference only.
171 The file_number and type_number elements are used if DBX_USE_BINCL 171 The file_number and type_number elements are used if DBX_USE_BINCL
172 is defined. */ 172 is defined. */
173 173
174 struct typeinfo GTY(()) 174 struct GTY(()) typeinfo {
175 {
176 enum typestatus status; 175 enum typestatus status;
177 int file_number; 176 int file_number;
178 int type_number; 177 int type_number;
179 }; 178 };
180 179
215 enum binclstatus bincl_status; /* Keep track of lazy bincl. */ 214 enum binclstatus bincl_status; /* Keep track of lazy bincl. */
216 const char *pending_bincl_name; /* Name of bincl. */ 215 const char *pending_bincl_name; /* Name of bincl. */
217 struct dbx_file *prev; /* Chain to traverse all pending bincls. */ 216 struct dbx_file *prev; /* Chain to traverse all pending bincls. */
218 }; 217 };
219 218
220 /* This is the top of the stack. 219 /* This is the top of the stack.
221 220
222 This is not saved for PCH, because restoring a PCH should not change it. 221 This is not saved for PCH, because restoring a PCH should not change it.
223 next_file_number does have to be saved, because the PCH may use some 222 next_file_number does have to be saved, because the PCH may use some
224 file numbers; however, just before restoring a PCH, next_file_number 223 file numbers; however, just before restoring a PCH, next_file_number
225 should always be 0 because we should not have needed any file numbers 224 should always be 0 because we should not have needed any file numbers
226 yet. */ 225 yet. */
274 #define FORCE_TEXT 273 #define FORCE_TEXT
275 #endif 274 #endif
276 275
277 #include "gstab.h" 276 #include "gstab.h"
278 277
279 #define STAB_CODE_TYPE enum __stab_debug_code
280
281 /* 1 if PARM is passed to this function in memory. */ 278 /* 1 if PARM is passed to this function in memory. */
282 279
283 #define PARM_PASSED_IN_MEMORY(PARM) \ 280 #define PARM_PASSED_IN_MEMORY(PARM) \
284 (MEM_P (DECL_INCOMING_RTL (PARM))) 281 (MEM_P (DECL_INCOMING_RTL (PARM)))
285 282
307 static void emit_pending_bincls (void); 304 static void emit_pending_bincls (void);
308 #endif 305 #endif
309 static inline void emit_pending_bincls_if_required (void); 306 static inline void emit_pending_bincls_if_required (void);
310 307
311 static void dbxout_init (const char *); 308 static void dbxout_init (const char *);
312 309
313 static void dbxout_finish (const char *); 310 static void dbxout_finish (const char *);
314 static void dbxout_start_source_file (unsigned, const char *); 311 static void dbxout_start_source_file (unsigned, const char *);
315 static void dbxout_end_source_file (unsigned); 312 static void dbxout_end_source_file (unsigned);
316 static void dbxout_typedefs (tree); 313 static void dbxout_typedefs (tree);
317 static void dbxout_type_index (tree); 314 static void dbxout_type_index (tree);
318 static void dbxout_args (tree); 315 static void dbxout_args (tree);
319 static void dbxout_type_fields (tree); 316 static void dbxout_type_fields (tree);
320 static void dbxout_type_method_1 (tree); 317 static void dbxout_type_method_1 (tree);
321 static void dbxout_type_methods (tree); 318 static void dbxout_type_methods (tree);
322 static void dbxout_range_type (tree); 319 static void dbxout_range_type (tree, tree, tree);
323 static void dbxout_type (tree, int); 320 static void dbxout_type (tree, int);
324 static bool print_int_cst_bounds_in_octal_p (tree); 321 static bool print_int_cst_bounds_in_octal_p (tree, tree, tree);
325 static bool is_fortran (void); 322 static bool is_fortran (void);
326 static void dbxout_type_name (tree); 323 static void dbxout_type_name (tree);
327 static void dbxout_class_name_qualifiers (tree); 324 static void dbxout_class_name_qualifiers (tree);
328 static int dbxout_symbol_location (tree, tree, const char *, rtx); 325 static int dbxout_symbol_location (tree, tree, const char *, rtx);
329 static void dbxout_symbol_name (tree, const char *, int); 326 static void dbxout_symbol_name (tree, const char *, int);
330 static void dbxout_common_name (tree, const char *, STAB_CODE_TYPE); 327 static void dbxout_common_name (tree, const char *, stab_code_type);
331 static const char *dbxout_common_check (tree, int *); 328 static const char *dbxout_common_check (tree, int *);
332 static void dbxout_global_decl (tree); 329 static void dbxout_global_decl (tree);
333 static void dbxout_type_decl (tree, int); 330 static void dbxout_type_decl (tree, int);
334 static void dbxout_handle_pch (unsigned); 331 static void dbxout_handle_pch (unsigned);
335 332
336 /* The debug hooks structure. */ 333 /* The debug hooks structure. */
337 #if defined (DBX_DEBUGGING_INFO) 334 #if defined (DBX_DEBUGGING_INFO)
338 335
339 static void dbxout_source_line (unsigned int, const char *); 336 static void dbxout_source_line (unsigned int, const char *, int, bool);
340 static void dbxout_begin_prologue (unsigned int, const char *); 337 static void dbxout_begin_prologue (unsigned int, const char *);
341 static void dbxout_source_file (const char *); 338 static void dbxout_source_file (const char *);
342 static void dbxout_function_end (tree); 339 static void dbxout_function_end (tree);
343 static void dbxout_begin_function (tree); 340 static void dbxout_begin_function (tree);
344 static void dbxout_begin_block (unsigned, unsigned); 341 static void dbxout_begin_block (unsigned, unsigned);
375 debug_nothing_tree, /* outlining_inline_function */ 372 debug_nothing_tree, /* outlining_inline_function */
376 debug_nothing_rtx, /* label */ 373 debug_nothing_rtx, /* label */
377 dbxout_handle_pch, /* handle_pch */ 374 dbxout_handle_pch, /* handle_pch */
378 debug_nothing_rtx, /* var_location */ 375 debug_nothing_rtx, /* var_location */
379 debug_nothing_void, /* switch_text_section */ 376 debug_nothing_void, /* switch_text_section */
377 debug_nothing_tree, /* direct_call */
378 debug_nothing_tree_int, /* virtual_call_token */
379 debug_nothing_rtx_rtx, /* copy_call_info */
380 debug_nothing_uid, /* virtual_call */
381 debug_nothing_tree_tree, /* set_name */
380 0 /* start_end_main_source_file */ 382 0 /* start_end_main_source_file */
381 }; 383 };
382 #endif /* DBX_DEBUGGING_INFO */ 384 #endif /* DBX_DEBUGGING_INFO */
383 385
384 #if defined (XCOFF_DEBUGGING_INFO) 386 #if defined (XCOFF_DEBUGGING_INFO)
408 debug_nothing_tree, /* outlining_inline_function */ 410 debug_nothing_tree, /* outlining_inline_function */
409 debug_nothing_rtx, /* label */ 411 debug_nothing_rtx, /* label */
410 dbxout_handle_pch, /* handle_pch */ 412 dbxout_handle_pch, /* handle_pch */
411 debug_nothing_rtx, /* var_location */ 413 debug_nothing_rtx, /* var_location */
412 debug_nothing_void, /* switch_text_section */ 414 debug_nothing_void, /* switch_text_section */
415 debug_nothing_tree, /* direct_call */
416 debug_nothing_tree_int, /* virtual_call_token */
417 debug_nothing_rtx_rtx, /* copy_call_info */
418 debug_nothing_uid, /* virtual_call */
419 debug_nothing_tree_tree, /* set_name */
413 0 /* start_end_main_source_file */ 420 0 /* start_end_main_source_file */
414 }; 421 };
415 #endif /* XCOFF_DEBUGGING_INFO */ 422 #endif /* XCOFF_DEBUGGING_INFO */
416 423
417 /* Numeric formatting helper macro. Note that this does not handle 424 /* Numeric formatting helper macro. Note that this does not handle
839 DBX_CONTIN_LENGTH-sized chunks. 846 DBX_CONTIN_LENGTH-sized chunks.
840 847
841 SYM is the DECL of the symbol under consideration; it is used only 848 SYM is the DECL of the symbol under consideration; it is used only
842 for its DECL_SOURCE_LINE. The other arguments are all passed directly 849 for its DECL_SOURCE_LINE. The other arguments are all passed directly
843 to DBX_FINISH_STABS; see above for details. */ 850 to DBX_FINISH_STABS; see above for details. */
844 851
845 static void 852 static void
846 dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code, 853 dbxout_finish_complex_stabs (tree sym, stab_code_type code,
847 rtx addr, const char *label, int number) 854 rtx addr, const char *label, int number)
848 { 855 {
849 int line ATTRIBUTE_UNUSED; 856 int line ATTRIBUTE_UNUSED;
850 char *str; 857 char *str;
851 size_t len; 858 size_t len;
893 It is faster to augment the string with the close quote and 900 It is faster to augment the string with the close quote and
894 comma than to do a two-character fputs. */ 901 comma than to do a two-character fputs. */
895 obstack_grow (&stabstr_ob, "\",", 2); 902 obstack_grow (&stabstr_ob, "\",", 2);
896 len = obstack_object_size (&stabstr_ob); 903 len = obstack_object_size (&stabstr_ob);
897 str = XOBFINISH (&stabstr_ob, char *); 904 str = XOBFINISH (&stabstr_ob, char *);
898 905
899 fwrite (str, 1, len, asm_out_file); 906 fwrite (str, 1, len, asm_out_file);
900 DBX_FINISH_STABS (sym, code, line, addr, label, number); 907 DBX_FINISH_STABS (sym, code, line, addr, label, number);
901 } 908 }
902 obstack_free (&stabstr_ob, str); 909 obstack_free (&stabstr_ob, str);
903 } 910 }
904 911
905 #if defined (DBX_DEBUGGING_INFO) 912 #if defined (DBX_DEBUGGING_INFO)
906 913
907 static void 914 static void
908 dbxout_function_end (tree decl) 915 dbxout_function_end (tree decl ATTRIBUTE_UNUSED)
909 { 916 {
910 char lscope_label_name[100]; 917 char lscope_label_name[100];
911 918
912 /* The Lscope label must be emitted even if we aren't doing anything 919 /* The Lscope label must be emitted even if we aren't doing anything
913 else; dbxout_block needs it. */ 920 else; dbxout_block needs it. */
914 switch_to_section (function_section (current_function_decl)); 921 switch_to_section (function_section (current_function_decl));
915 922
916 /* Convert Lscope into the appropriate format for local labels in case 923 /* Convert Lscope into the appropriate format for local labels in case
917 the system doesn't insert underscores in front of user generated 924 the system doesn't insert underscores in front of user generated
918 labels. */ 925 labels. */
919 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno); 926 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
920 targetm.asm_out.internal_label (asm_out_file, "Lscope", scope_labelno); 927 targetm.asm_out.internal_label (asm_out_file, "Lscope", scope_labelno);
922 /* The N_FUN tag at the end of the function is a GNU extension, 929 /* The N_FUN tag at the end of the function is a GNU extension,
923 which may be undesirable, and is unnecessary if we do not have 930 which may be undesirable, and is unnecessary if we do not have
924 named sections. */ 931 named sections. */
925 if (!use_gnu_debug_info_extensions 932 if (!use_gnu_debug_info_extensions
926 || NO_DBX_FUNCTION_END 933 || NO_DBX_FUNCTION_END
927 || !targetm.have_named_sections 934 || !targetm.have_named_sections)
928 || DECL_IGNORED_P (decl))
929 return; 935 return;
930 936
931 /* By convention, GCC will mark the end of a function with an N_FUN 937 /* By convention, GCC will mark the end of a function with an N_FUN
932 symbol and an empty string. */ 938 symbol and an empty string. */
933 if (flag_reorder_blocks_and_partition) 939 if (flag_reorder_blocks_and_partition)
934 { 940 {
935 dbxout_begin_empty_stabs (N_FUN); 941 dbxout_begin_empty_stabs (N_FUN);
936 dbxout_stab_value_label_diff (crtl->subsections.hot_section_end_label, 942 dbxout_stab_value_label_diff (crtl->subsections.hot_section_end_label,
937 crtl->subsections.hot_section_label); 943 crtl->subsections.hot_section_label);
938 dbxout_begin_empty_stabs (N_FUN); 944 dbxout_begin_empty_stabs (N_FUN);
939 dbxout_stab_value_label_diff (crtl->subsections.cold_section_end_label, 945 dbxout_stab_value_label_diff (crtl->subsections.cold_section_end_label,
940 crtl->subsections.cold_section_label); 946 crtl->subsections.cold_section_label);
941 } 947 }
942 else 948 else
943 { 949 {
944 char begin_label[20]; 950 char begin_label[20];
1170 #ifdef DBX_USE_BINCL 1176 #ifdef DBX_USE_BINCL
1171 struct dbx_file *n = XNEW (struct dbx_file); 1177 struct dbx_file *n = XNEW (struct dbx_file);
1172 1178
1173 n->next = current_file; 1179 n->next = current_file;
1174 n->next_type_number = 1; 1180 n->next_type_number = 1;
1175 /* Do not assign file number now. 1181 /* Do not assign file number now.
1176 Delay it until we actually emit BINCL. */ 1182 Delay it until we actually emit BINCL. */
1177 n->file_number = 0; 1183 n->file_number = 0;
1178 n->prev = NULL; 1184 n->prev = NULL;
1179 current_file->prev = n; 1185 current_file->prev = n;
1180 n->bincl_status = BINCL_PENDING; 1186 n->bincl_status = BINCL_PENDING;
1251 dbxout_stab_value_internal_label ("Ltext", &source_label_number); 1257 dbxout_stab_value_internal_label ("Ltext", &source_label_number);
1252 lastfile = filename; 1258 lastfile = filename;
1253 } 1259 }
1254 } 1260 }
1255 1261
1256 /* Output N_BNSYM, line number symbol entry, and local symbol at 1262 /* Output N_BNSYM, line number symbol entry, and local symbol at
1257 function scope */ 1263 function scope */
1258 1264
1259 static void 1265 static void
1260 dbxout_begin_prologue (unsigned int lineno, const char *filename) 1266 dbxout_begin_prologue (unsigned int lineno, const char *filename)
1261 { 1267 {
1266 dbxout_stabd (N_BNSYM, 0); 1272 dbxout_stabd (N_BNSYM, 0);
1267 1273
1268 /* pre-increment the scope counter */ 1274 /* pre-increment the scope counter */
1269 scope_labelno++; 1275 scope_labelno++;
1270 1276
1271 dbxout_source_line (lineno, filename); 1277 dbxout_source_line (lineno, filename, 0, true);
1272 /* Output function begin block at function scope, referenced 1278 /* Output function begin block at function scope, referenced
1273 by dbxout_block, dbxout_source_line and dbxout_function_end. */ 1279 by dbxout_block, dbxout_source_line and dbxout_function_end. */
1274 emit_pending_bincls_if_required (); 1280 emit_pending_bincls_if_required ();
1275 targetm.asm_out.internal_label (asm_out_file, "LFBB", scope_labelno); 1281 targetm.asm_out.internal_label (asm_out_file, "LFBB", scope_labelno);
1276 } 1282 }
1277 1283
1278 /* Output a line number symbol entry for source file FILENAME and line 1284 /* Output a line number symbol entry for source file FILENAME and line
1279 number LINENO. */ 1285 number LINENO. */
1280 1286
1281 static void 1287 static void
1282 dbxout_source_line (unsigned int lineno, const char *filename) 1288 dbxout_source_line (unsigned int lineno, const char *filename,
1289 int discriminator ATTRIBUTE_UNUSED,
1290 bool is_stmt ATTRIBUTE_UNUSED)
1283 { 1291 {
1284 dbxout_source_file (filename); 1292 dbxout_source_file (filename);
1285 1293
1286 #ifdef DBX_OUTPUT_SOURCE_LINE 1294 #ifdef DBX_OUTPUT_SOURCE_LINE
1287 DBX_OUTPUT_SOURCE_LINE (asm_out_file, lineno, dbxout_source_line_counter); 1295 DBX_OUTPUT_SOURCE_LINE (asm_out_file, lineno, dbxout_source_line_counter);
1289 if (DBX_LINES_FUNCTION_RELATIVE) 1297 if (DBX_LINES_FUNCTION_RELATIVE)
1290 { 1298 {
1291 char begin_label[20]; 1299 char begin_label[20];
1292 dbxout_begin_stabn_sline (lineno); 1300 dbxout_begin_stabn_sline (lineno);
1293 /* Reference current function start using LFBB. */ 1301 /* Reference current function start using LFBB. */
1294 ASM_GENERATE_INTERNAL_LABEL (begin_label, "LFBB", scope_labelno); 1302 ASM_GENERATE_INTERNAL_LABEL (begin_label, "LFBB", scope_labelno);
1295 dbxout_stab_value_internal_label_diff ("LM", &dbxout_source_line_counter, 1303 dbxout_stab_value_internal_label_diff ("LM", &dbxout_source_line_counter,
1296 begin_label); 1304 begin_label);
1297 } 1305 }
1298 else 1306 else
1299 dbxout_stabd (N_SLINE, lineno); 1307 dbxout_stabd (N_SLINE, lineno);
1592 } 1600 }
1593 } 1601 }
1594 1602
1595 /* Emit a "range" type specification, which has the form: 1603 /* Emit a "range" type specification, which has the form:
1596 "r<index type>;<lower bound>;<upper bound>;". 1604 "r<index type>;<lower bound>;<upper bound>;".
1597 TYPE is an INTEGER_TYPE. */ 1605 TYPE is an INTEGER_TYPE, LOW and HIGH are the bounds. */
1598 1606
1599 static void 1607 static void
1600 dbxout_range_type (tree type) 1608 dbxout_range_type (tree type, tree low, tree high)
1601 { 1609 {
1602 stabstr_C ('r'); 1610 stabstr_C ('r');
1603 if (TREE_TYPE (type)) 1611 if (TREE_TYPE (type))
1604 dbxout_type (TREE_TYPE (type), 0); 1612 dbxout_type (TREE_TYPE (type), 0);
1605 else if (TREE_CODE (type) != INTEGER_TYPE) 1613 else if (TREE_CODE (type) != INTEGER_TYPE)
1623 else 1631 else
1624 dbxout_type_index (integer_type_node); 1632 dbxout_type_index (integer_type_node);
1625 } 1633 }
1626 1634
1627 stabstr_C (';'); 1635 stabstr_C (';');
1628 if (TYPE_MIN_VALUE (type) != 0 1636 if (low && host_integerp (low, 0))
1629 && host_integerp (TYPE_MIN_VALUE (type), 0)) 1637 {
1630 { 1638 if (print_int_cst_bounds_in_octal_p (type, low, high))
1631 if (print_int_cst_bounds_in_octal_p (type)) 1639 stabstr_O (low);
1632 stabstr_O (TYPE_MIN_VALUE (type));
1633 else 1640 else
1634 stabstr_D (tree_low_cst (TYPE_MIN_VALUE (type), 0)); 1641 stabstr_D (tree_low_cst (low, 0));
1635 } 1642 }
1636 else 1643 else
1637 stabstr_C ('0'); 1644 stabstr_C ('0');
1638 1645
1639 stabstr_C (';'); 1646 stabstr_C (';');
1640 if (TYPE_MAX_VALUE (type) != 0 1647 if (high && host_integerp (high, 0))
1641 && host_integerp (TYPE_MAX_VALUE (type), 0)) 1648 {
1642 { 1649 if (print_int_cst_bounds_in_octal_p (type, low, high))
1643 if (print_int_cst_bounds_in_octal_p (type)) 1650 stabstr_O (high);
1644 stabstr_O (TYPE_MAX_VALUE (type));
1645 else 1651 else
1646 stabstr_D (tree_low_cst (TYPE_MAX_VALUE (type), 0)); 1652 stabstr_D (tree_low_cst (high, 0));
1647 stabstr_C (';'); 1653 stabstr_C (';');
1648 } 1654 }
1649 else 1655 else
1650 stabstr_S ("-1;"); 1656 stabstr_S ("-1;");
1651 } 1657 }
1662 using the number previously allocated. */ 1668 using the number previously allocated. */
1663 1669
1664 static void 1670 static void
1665 dbxout_type (tree type, int full) 1671 dbxout_type (tree type, int full)
1666 { 1672 {
1667 tree tem;
1668 tree main_variant;
1669 static int anonymous_type_number = 0; 1673 static int anonymous_type_number = 0;
1670 bool vector_type = false; 1674 bool vector_type = false;
1675 tree tem, main_variant, low, high;
1671 1676
1672 if (TREE_CODE (type) == VECTOR_TYPE) 1677 if (TREE_CODE (type) == VECTOR_TYPE)
1673 { 1678 {
1674 /* The frontend feeds us a representation for the vector as a struct 1679 /* The frontend feeds us a representation for the vector as a struct
1675 containing an array. Pull out the array type. */ 1680 containing an array. Pull out the array type. */
1676 type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type))); 1681 type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type)));
1677 vector_type = true; 1682 vector_type = true;
1683 }
1684
1685 if (TREE_CODE (type) == INTEGER_TYPE)
1686 {
1687 if (TREE_TYPE (type) == 0)
1688 {
1689 low = TYPE_MIN_VALUE (type);
1690 high = TYPE_MAX_VALUE (type);
1691 }
1692
1693 else if (subrange_type_for_debug_p (type, &low, &high))
1694 ;
1695
1696 /* If this is a subtype that should not be emitted as a subrange type,
1697 use the base type. */
1698 else
1699 {
1700 type = TREE_TYPE (type);
1701 low = TYPE_MIN_VALUE (type);
1702 high = TYPE_MAX_VALUE (type);
1703 }
1678 } 1704 }
1679 1705
1680 /* If there was an input error and we don't really have a type, 1706 /* If there was an input error and we don't really have a type,
1681 avoid crashing and write something that is at least valid 1707 avoid crashing and write something that is at least valid
1682 by assuming `int'. */ 1708 by assuming `int'. */
1876 stabstr_S ("@s"); 1902 stabstr_S ("@s");
1877 stabstr_D (TYPE_PRECISION (type)); 1903 stabstr_D (TYPE_PRECISION (type));
1878 stabstr_C (';'); 1904 stabstr_C (';');
1879 } 1905 }
1880 1906
1881 dbxout_range_type (type); 1907 dbxout_range_type (type, low, high);
1882 } 1908 }
1883 1909
1884 else 1910 else
1885 { 1911 {
1886 /* If the size is non-standard, say what it is if we can use 1912 /* If the size is non-standard, say what it is if we can use
1892 stabstr_S ("@s"); 1918 stabstr_S ("@s");
1893 stabstr_D (TYPE_PRECISION (type)); 1919 stabstr_D (TYPE_PRECISION (type));
1894 stabstr_C (';'); 1920 stabstr_C (';');
1895 } 1921 }
1896 1922
1897 if (print_int_cst_bounds_in_octal_p (type)) 1923 if (print_int_cst_bounds_in_octal_p (type, low, high))
1898 { 1924 {
1899 stabstr_C ('r'); 1925 stabstr_C ('r');
1900 1926
1901 /* If this type derives from another type, output type index of 1927 /* If this type derives from another type, output type index of
1902 parent type. This is particularly important when parent type 1928 parent type. This is particularly important when parent type
1907 dbxout_type_index (TREE_TYPE (type)); 1933 dbxout_type_index (TREE_TYPE (type));
1908 else 1934 else
1909 dbxout_type_index (type); 1935 dbxout_type_index (type);
1910 1936
1911 stabstr_C (';'); 1937 stabstr_C (';');
1912 stabstr_O (TYPE_MIN_VALUE (type)); 1938 stabstr_O (low);
1913 stabstr_C (';'); 1939 stabstr_C (';');
1914 stabstr_O (TYPE_MAX_VALUE (type)); 1940 stabstr_O (high);
1915 stabstr_C (';'); 1941 stabstr_C (';');
1916 } 1942 }
1917 1943
1918 else 1944 else
1919 /* Output other integer types as subranges of `int'. */ 1945 /* Output other integer types as subranges of `int'. */
1920 dbxout_range_type (type); 1946 dbxout_range_type (type, low, high);
1921 } 1947 }
1922 1948
1923 break; 1949 break;
1924 1950
1925 case REAL_TYPE: 1951 case REAL_TYPE:
2009 stabstr_S (";0;-1;"); 2035 stabstr_S (";0;-1;");
2010 } 2036 }
2011 else 2037 else
2012 { 2038 {
2013 stabstr_C ('a'); 2039 stabstr_C ('a');
2014 dbxout_range_type (tem); 2040 dbxout_range_type (tem, TYPE_MIN_VALUE (tem), TYPE_MAX_VALUE (tem));
2015 } 2041 }
2016 2042
2017 dbxout_type (TREE_TYPE (type), 0); 2043 dbxout_type (TREE_TYPE (type), 0);
2018 break; 2044 break;
2019 2045
2065 if (binfo) 2091 if (binfo)
2066 { 2092 {
2067 int i; 2093 int i;
2068 tree child; 2094 tree child;
2069 VEC(tree,gc) *accesses = BINFO_BASE_ACCESSES (binfo); 2095 VEC(tree,gc) *accesses = BINFO_BASE_ACCESSES (binfo);
2070 2096
2071 if (use_gnu_debug_info_extensions) 2097 if (use_gnu_debug_info_extensions)
2072 { 2098 {
2073 if (BINFO_N_BASE_BINFOS (binfo)) 2099 if (BINFO_N_BASE_BINFOS (binfo))
2074 { 2100 {
2075 stabstr_C ('!'); 2101 stabstr_C ('!');
2257 2283
2258 /* Return nonzero if the given type represents an integer whose bounds 2284 /* Return nonzero if the given type represents an integer whose bounds
2259 should be printed in octal format. */ 2285 should be printed in octal format. */
2260 2286
2261 static bool 2287 static bool
2262 print_int_cst_bounds_in_octal_p (tree type) 2288 print_int_cst_bounds_in_octal_p (tree type, tree low, tree high)
2263 { 2289 {
2264 /* If we can use GDB extensions and the size is wider than a long 2290 /* If we can use GDB extensions and the size is wider than a long
2265 (the size used by GDB to read them) or we may have trouble writing 2291 (the size used by GDB to read them) or we may have trouble writing
2266 the bounds the usual way, write them in octal. Note the test is for 2292 the bounds the usual way, write them in octal. Note the test is for
2267 the *target's* size of "long", not that of the host. The host test 2293 the *target's* size of "long", not that of the host. The host test
2271 For unsigned types, we use octal if they are the same size or larger. 2297 For unsigned types, we use octal if they are the same size or larger.
2272 This is because we print the bounds as signed decimal, and hence they 2298 This is because we print the bounds as signed decimal, and hence they
2273 can't span same size unsigned types. */ 2299 can't span same size unsigned types. */
2274 2300
2275 if (use_gnu_debug_info_extensions 2301 if (use_gnu_debug_info_extensions
2276 && TYPE_MIN_VALUE (type) != 0 2302 && low && TREE_CODE (low) == INTEGER_CST
2277 && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST 2303 && high && TREE_CODE (high) == INTEGER_CST
2278 && TYPE_MAX_VALUE (type) != 0
2279 && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
2280 && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node) 2304 && (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
2281 || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)) 2305 || ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
2282 && TYPE_UNSIGNED (type)) 2306 && TYPE_UNSIGNED (type))
2283 || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT 2307 || TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
2284 || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT 2308 || (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
2294 2318
2295 static void 2319 static void
2296 dbxout_type_name (tree type) 2320 dbxout_type_name (tree type)
2297 { 2321 {
2298 tree t = TYPE_NAME (type); 2322 tree t = TYPE_NAME (type);
2299 2323
2300 gcc_assert (t); 2324 gcc_assert (t);
2301 switch (TREE_CODE (t)) 2325 switch (TREE_CODE (t))
2302 { 2326 {
2303 case IDENTIFIER_NODE: 2327 case IDENTIFIER_NODE:
2304 break; 2328 break;
2815 2839
2816 decl_rtl = dbxout_expand_expr (decl); 2840 decl_rtl = dbxout_expand_expr (decl);
2817 if (!decl_rtl) 2841 if (!decl_rtl)
2818 DBXOUT_DECR_NESTING_AND_RETURN (0); 2842 DBXOUT_DECR_NESTING_AND_RETURN (0);
2819 2843
2820 decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX); 2844 decl_rtl = eliminate_regs (decl_rtl, VOIDmode, NULL_RTX);
2821 #ifdef LEAF_REG_REMAP 2845 #ifdef LEAF_REG_REMAP
2822 if (current_function_uses_only_leaf_regs) 2846 if (current_function_uses_only_leaf_regs)
2823 leaf_renumber_regs_insn (decl_rtl); 2847 leaf_renumber_regs_insn (decl_rtl);
2824 #endif 2848 #endif
2825 2849
2841 2865
2842 static int 2866 static int
2843 dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home) 2867 dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
2844 { 2868 {
2845 int letter = 0; 2869 int letter = 0;
2846 STAB_CODE_TYPE code; 2870 stab_code_type code;
2847 rtx addr = 0; 2871 rtx addr = 0;
2848 int number = 0; 2872 int number = 0;
2849 int regno = -1; 2873 int regno = -1;
2850 2874
2851 /* Don't mention a variable at all 2875 /* Don't mention a variable at all
3021 code = N_LSYM; 3045 code = N_LSYM;
3022 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0)); 3046 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
3023 } 3047 }
3024 else if (MEM_P (home) 3048 else if (MEM_P (home)
3025 && GET_CODE (XEXP (home, 0)) == PLUS 3049 && GET_CODE (XEXP (home, 0)) == PLUS
3026 && GET_CODE (XEXP (XEXP (home, 0), 1)) == CONST_INT) 3050 && CONST_INT_P (XEXP (XEXP (home, 0), 1)))
3027 { 3051 {
3028 code = N_LSYM; 3052 code = N_LSYM;
3029 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...))) 3053 /* RTL looks like (MEM (PLUS (REG...) (CONST_INT...)))
3030 We want the value of that CONST_INT. */ 3054 We want the value of that CONST_INT. */
3031 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0)); 3055 number = DEBUGGER_AUTO_OFFSET (XEXP (home, 0));
3112 static void 3136 static void
3113 dbxout_symbol_name (tree decl, const char *suffix, int letter) 3137 dbxout_symbol_name (tree decl, const char *suffix, int letter)
3114 { 3138 {
3115 tree name; 3139 tree name;
3116 3140
3117 if (DECL_CONTEXT (decl) 3141 if (DECL_CONTEXT (decl)
3118 && (TYPE_P (DECL_CONTEXT (decl)) 3142 && (TYPE_P (DECL_CONTEXT (decl))
3119 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)) 3143 || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL))
3120 /* One slight hitch: if this is a VAR_DECL which is a class member 3144 /* One slight hitch: if this is a VAR_DECL which is a class member
3121 or a namespace member, we must put out the mangled name instead of the 3145 or a namespace member, we must put out the mangled name instead of the
3122 DECL_NAME. Note also that static member (variable) names DO NOT begin 3146 DECL_NAME. Note also that static member (variable) names DO NOT begin
3146 around each group of symbols in the same .comm area. The N_GSYM stabs 3170 around each group of symbols in the same .comm area. The N_GSYM stabs
3147 that are emitted only contain the offset in the common area. This routine 3171 that are emitted only contain the offset in the common area. This routine
3148 emits the N_BCOMM and N_ECOMM stabs. */ 3172 emits the N_BCOMM and N_ECOMM stabs. */
3149 3173
3150 static void 3174 static void
3151 dbxout_common_name (tree decl, const char *name, STAB_CODE_TYPE op) 3175 dbxout_common_name (tree decl, const char *name, stab_code_type op)
3152 { 3176 {
3153 dbxout_begin_complex_stabs (); 3177 dbxout_begin_complex_stabs ();
3154 stabstr_S (name); 3178 stabstr_S (name);
3155 dbxout_finish_complex_stabs (decl, op, NULL_RTX, NULL, 0); 3179 dbxout_finish_complex_stabs (decl, op, NULL_RTX, NULL, 0);
3156 } 3180 }
3164 dbxout_common_check (tree decl, int *value) 3188 dbxout_common_check (tree decl, int *value)
3165 { 3189 {
3166 rtx home; 3190 rtx home;
3167 rtx sym_addr; 3191 rtx sym_addr;
3168 const char *name = NULL; 3192 const char *name = NULL;
3169 3193
3170 /* If the decl isn't a VAR_DECL, or if it isn't public or static, or if 3194 /* If the decl isn't a VAR_DECL, or if it isn't static, or if
3171 it does not have a value (the offset into the common area), or if it 3195 it does not have a value (the offset into the common area), or if it
3172 is thread local (as opposed to global) then it isn't common, and shouldn't 3196 is thread local (as opposed to global) then it isn't common, and shouldn't
3173 be handled as such. 3197 be handled as such.
3174 3198
3175 ??? DECL_THREAD_LOCAL_P check prevents problems with improper .stabs 3199 ??? DECL_THREAD_LOCAL_P check prevents problems with improper .stabs
3176 for thread-local symbols. Can be handled via same mechanism as used 3200 for thread-local symbols. Can be handled via same mechanism as used
3177 in dwarf2out.c. */ 3201 in dwarf2out.c. */
3178 if (TREE_CODE (decl) != VAR_DECL 3202 if (TREE_CODE (decl) != VAR_DECL
3179 || !TREE_PUBLIC(decl)
3180 || !TREE_STATIC(decl) 3203 || !TREE_STATIC(decl)
3181 || !DECL_HAS_VALUE_EXPR_P(decl) 3204 || !DECL_HAS_VALUE_EXPR_P(decl)
3182 || DECL_THREAD_LOCAL_P (decl) 3205 || DECL_THREAD_LOCAL_P (decl)
3183 || !is_fortran ()) 3206 || !is_fortran ())
3184 return NULL; 3207 return NULL;
3185 3208
3186 home = DECL_RTL (decl); 3209 home = DECL_RTL (decl);
3187 if (home == NULL_RTX || GET_CODE (home) != MEM) 3210 if (home == NULL_RTX || GET_CODE (home) != MEM)
3188 return NULL; 3211 return NULL;
3189 3212
3190 sym_addr = dbxout_expand_expr (DECL_VALUE_EXPR (decl)); 3213 sym_addr = dbxout_expand_expr (DECL_VALUE_EXPR (decl));
3191 if (sym_addr == NULL_RTX || GET_CODE (sym_addr) != MEM) 3214 if (sym_addr == NULL_RTX || GET_CODE (sym_addr) != MEM)
3207 tree cdecl = NULL; 3230 tree cdecl = NULL;
3208 3231
3209 switch (GET_CODE (sym_addr)) 3232 switch (GET_CODE (sym_addr))
3210 { 3233 {
3211 case PLUS: 3234 case PLUS:
3212 if (GET_CODE (XEXP (sym_addr, 0)) == CONST_INT) 3235 if (CONST_INT_P (XEXP (sym_addr, 0)))
3213 { 3236 {
3214 name = 3237 name =
3215 targetm.strip_name_encoding(XSTR (XEXP (sym_addr, 1), 0)); 3238 targetm.strip_name_encoding(XSTR (XEXP (sym_addr, 1), 0));
3216 *value = INTVAL (XEXP (sym_addr, 0)); 3239 *value = INTVAL (XEXP (sym_addr, 0));
3217 cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 1)); 3240 cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 1));
3314 && DECL_RTL_SET_P (parms) 3337 && DECL_RTL_SET_P (parms)
3315 && DECL_INCOMING_RTL (parms)) 3338 && DECL_INCOMING_RTL (parms))
3316 { 3339 {
3317 tree eff_type; 3340 tree eff_type;
3318 char letter; 3341 char letter;
3319 STAB_CODE_TYPE code; 3342 stab_code_type code;
3320 int number; 3343 int number;
3321 3344
3322 /* Perform any necessary register eliminations on the parameter's rtl, 3345 /* Perform any necessary register eliminations on the parameter's rtl,
3323 so that the debugging output will be accurate. */ 3346 so that the debugging output will be accurate. */
3324 DECL_INCOMING_RTL (parms) 3347 DECL_INCOMING_RTL (parms)
3325 = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX); 3348 = eliminate_regs (DECL_INCOMING_RTL (parms), VOIDmode, NULL_RTX);
3326 SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX)); 3349 SET_DECL_RTL (parms,
3350 eliminate_regs (DECL_RTL (parms), VOIDmode, NULL_RTX));
3327 #ifdef LEAF_REG_REMAP 3351 #ifdef LEAF_REG_REMAP
3328 if (current_function_uses_only_leaf_regs) 3352 if (current_function_uses_only_leaf_regs)
3329 { 3353 {
3330 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms)); 3354 leaf_renumber_regs_insn (DECL_INCOMING_RTL (parms));
3331 leaf_renumber_regs_insn (DECL_RTL (parms)); 3355 leaf_renumber_regs_insn (DECL_RTL (parms));
3339 /* ??? Here we assume that the parm address is indexed 3363 /* ??? Here we assume that the parm address is indexed
3340 off the frame pointer or arg pointer. 3364 off the frame pointer or arg pointer.
3341 If that is not true, we produce meaningless results, 3365 If that is not true, we produce meaningless results,
3342 but do not crash. */ 3366 but do not crash. */
3343 if (GET_CODE (inrtl) == PLUS 3367 if (GET_CODE (inrtl) == PLUS
3344 && GET_CODE (XEXP (inrtl, 1)) == CONST_INT) 3368 && CONST_INT_P (XEXP (inrtl, 1)))
3345 number = INTVAL (XEXP (inrtl, 1)); 3369 number = INTVAL (XEXP (inrtl, 1));
3346 else 3370 else
3347 number = 0; 3371 number = 0;
3348 3372
3349 code = N_PSYM; 3373 code = N_PSYM;
3405 Output it as if it lived in that register. 3429 Output it as if it lived in that register.
3406 The debugger will know from the type 3430 The debugger will know from the type
3407 that it was actually passed by invisible reference. */ 3431 that it was actually passed by invisible reference. */
3408 3432
3409 code = DBX_REGPARM_STABS_CODE; 3433 code = DBX_REGPARM_STABS_CODE;
3410 3434
3411 /* GDB likes this marked with a special letter. */ 3435 /* GDB likes this marked with a special letter. */
3412 letter = (use_gnu_debug_info_extensions 3436 letter = (use_gnu_debug_info_extensions
3413 ? 'a' : DBX_REGPARM_STABS_LETTER); 3437 ? 'a' : DBX_REGPARM_STABS_LETTER);
3414 eff_type = TREE_TYPE (parms); 3438 eff_type = TREE_TYPE (parms);
3415 3439
3476 else 3500 else
3477 /* ??? We don't know how to represent this argument. */ 3501 /* ??? We don't know how to represent this argument. */
3478 continue; 3502 continue;
3479 3503
3480 dbxout_begin_complex_stabs (); 3504 dbxout_begin_complex_stabs ();
3481 3505
3482 if (DECL_NAME (parms)) 3506 if (DECL_NAME (parms))
3483 { 3507 {
3484 stabstr_I (DECL_NAME (parms)); 3508 stabstr_I (DECL_NAME (parms));
3485 stabstr_C (':'); 3509 stabstr_C (':');
3486 } 3510 }
3665 static void 3689 static void
3666 dbxout_begin_function (tree decl) 3690 dbxout_begin_function (tree decl)
3667 { 3691 {
3668 int saved_tree_used1; 3692 int saved_tree_used1;
3669 3693
3670 if (DECL_IGNORED_P (decl))
3671 return;
3672
3673 saved_tree_used1 = TREE_USED (decl); 3694 saved_tree_used1 = TREE_USED (decl);
3674 TREE_USED (decl) = 1; 3695 TREE_USED (decl) = 1;
3675 if (DECL_NAME (DECL_RESULT (decl)) != 0) 3696 if (DECL_NAME (DECL_RESULT (decl)) != 0)
3676 { 3697 {
3677 int saved_tree_used2 = TREE_USED (DECL_RESULT (decl)); 3698 int saved_tree_used2 = TREE_USED (DECL_RESULT (decl));