diff options
Diffstat (limited to 'gcc/dwarfout.c')
-rw-r--r-- | gcc/dwarfout.c | 81 |
1 files changed, 52 insertions, 29 deletions
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 660865b11d6..388c4a40081 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -1,5 +1,5 @@ /* Output Dwarf format symbol table information from the GNU C compiler. - Copyright (C) 1992, 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 95-98, 1999 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com) of Network Computing Devices. This file is part of GNU CC. @@ -63,10 +63,6 @@ extern char *getpwd PROTO((void)); /* Note that the implementation of C++ support herein is (as yet) unfinished. If you want to try to complete it, more power to you. */ -#if !defined(__GNUC__) || (NDEBUG != 1) -#define inline -#endif - /* How to start an assembler comment. */ #ifndef ASM_COMMENT_START #define ASM_COMMENT_START ";#" @@ -857,10 +853,20 @@ static int is_redundant_typedef PROTO((tree)); } while (0) #endif +/* ASM_OUTPUT_DWARF_STRING is defined to output an ascii string, but to + NOT issue a trailing newline. We define ASM_OUTPUT_DWARF_STRING_NEWLINE + based on whether ASM_OUTPUT_DWARF_STRING is defined or not. If it is + defined, we call it, then issue the line feed. If not, we supply a + default defintion of calling ASM_OUTPUT_ASCII */ + #ifndef ASM_OUTPUT_DWARF_STRING -#define ASM_OUTPUT_DWARF_STRING(FILE,P) \ +#define ASM_OUTPUT_DWARF_STRING_NEWLINE(FILE,P) \ ASM_OUTPUT_ASCII ((FILE), P, strlen (P)+1) +#else +#define ASM_OUTPUT_DWARF_STRING_NEWLINE(FILE,P) \ + ASM_OUTPUT_DWARF_STRING (FILE,P), ASM_OUTPUT_DWARF_STRING (FILE,"\n") #endif + /************************ general utility functions **************************/ @@ -1893,7 +1899,7 @@ output_enumeral_list (link) output_enumeral_list (TREE_CHAIN (link)); ASM_OUTPUT_DWARF_DATA4 (asm_out_file, (unsigned) TREE_INT_CST_LOW (TREE_VALUE (link))); - ASM_OUTPUT_DWARF_STRING (asm_out_file, + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, IDENTIFIER_POINTER (TREE_PURPOSE (link))); } } @@ -2256,7 +2262,7 @@ const_value_attribute (rtl) break; case CONST_STRING: - ASM_OUTPUT_DWARF_STRING (asm_out_file, XSTR (rtl, 0)); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, XSTR (rtl, 0)); break; case SYMBOL_REF: @@ -2466,7 +2472,7 @@ name_attribute (name_string) if (name_string && *name_string) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_name); - ASM_OUTPUT_DWARF_STRING (asm_out_file, name_string); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, name_string); } } @@ -2904,7 +2910,7 @@ comp_dir_attribute (dirname) register char *dirname; { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_comp_dir); - ASM_OUTPUT_DWARF_STRING (asm_out_file, dirname); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname); } static inline void @@ -2942,7 +2948,7 @@ prototyped_attribute (func_type) && (TYPE_ARG_TYPES (func_type) != NULL)) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_prototyped); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); } } @@ -2951,7 +2957,7 @@ producer_attribute (producer) register char *producer; { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_producer); - ASM_OUTPUT_DWARF_STRING (asm_out_file, producer); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, producer); } static inline void @@ -2961,7 +2967,7 @@ inline_attribute (decl) if (DECL_INLINE (decl)) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_inline); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); } } @@ -3024,7 +3030,7 @@ pure_or_virtual_attribute (func_decl) else #endif ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); } } @@ -3513,7 +3519,12 @@ output_label_die (arg) { register rtx insn = DECL_RTL (decl); - if (GET_CODE (insn) == CODE_LABEL) + /* Deleted labels are programmer specified labels which have been + eliminated because of various optimisations. We still emit them + here so that it is possible to put breakpoints on them. */ + if (GET_CODE (insn) == CODE_LABEL + || ((GET_CODE (insn) == NOTE + && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL))) { char label[MAX_ARTIFICIAL_LABEL_BYTES]; @@ -3751,17 +3762,17 @@ output_inheritance_die (arg) if (TREE_VIA_VIRTUAL (binfo)) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_virtual); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); } if (TREE_VIA_PUBLIC (binfo)) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_public); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); } else if (TREE_VIA_PROTECTED (binfo)) { ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_protected); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); } } @@ -5121,7 +5132,7 @@ dwarfout_file_scope_decl (decl, set_finalizing) ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION); sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number); ASM_OUTPUT_DWARF_ADDR (asm_out_file, label); - ASM_OUTPUT_DWARF_STRING (asm_out_file, + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, IDENTIFIER_POINTER (DECL_NAME (decl))); ASM_OUTPUT_POP_SECTION (asm_out_file); } @@ -5159,7 +5170,7 @@ dwarfout_file_scope_decl (decl, set_finalizing) ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION); sprintf (label, PUB_DIE_LABEL_FMT, next_pubname_number); ASM_OUTPUT_DWARF_ADDR (asm_out_file, label); - ASM_OUTPUT_DWARF_STRING (asm_out_file, + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, IDENTIFIER_POINTER (DECL_NAME (decl))); ASM_OUTPUT_POP_SECTION (asm_out_file); } @@ -5247,10 +5258,16 @@ dwarfout_file_scope_decl (decl, set_finalizing) output_pending_types_for_scope (NULL_TREE); - /* The above call should have totally emptied the pending_types_list. */ - - if (pending_types != 0) - abort (); + /* The above call should have totally emptied the pending_types_list + if this is not a nested function or class. If this is a nested type, + then the remaining pending_types will be emitted when the containing type + is handled. */ + + if (! DECL_CONTEXT (decl)) + { + if (pending_types != 0) + abort (); + } ASM_OUTPUT_POP_SECTION (asm_out_file); @@ -5386,7 +5403,7 @@ generate_new_sfname_entry () ASM_OUTPUT_PUSH_SECTION (asm_out_file, SFNAMES_SECTION); sprintf (label, SFNAMES_ENTRY_LABEL_FMT, filename_table[0].number); ASM_OUTPUT_LABEL (asm_out_file, label); - ASM_OUTPUT_DWARF_STRING (asm_out_file, + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, filename_table[0].name ? filename_table[0].name : ""); @@ -5559,7 +5576,7 @@ generate_macinfo_entry (type_and_offset, string) fputc ('\n', asm_out_file); ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION); fprintf (asm_out_file, "\t%s\t%s\n", UNALIGNED_INT_ASM_OP, type_and_offset); - ASM_OUTPUT_DWARF_STRING (asm_out_file, string); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, string); ASM_OUTPUT_POP_SECTION (asm_out_file); } @@ -5740,7 +5757,7 @@ dwarfout_init (asm_out_file, main_input_filename) strcpy (dirname, pwd); strcpy (dirname + len, "/"); - ASM_OUTPUT_DWARF_STRING (asm_out_file, dirname); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, dirname); free (dirname); } ASM_OUTPUT_POP_SECTION (asm_out_file); @@ -5944,7 +5961,7 @@ dwarfout_finish () fputc ('\n', asm_out_file); ASM_OUTPUT_PUSH_SECTION (asm_out_file, MACINFO_SECTION); ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); ASM_OUTPUT_POP_SECTION (asm_out_file); } @@ -5953,7 +5970,7 @@ dwarfout_finish () fputc ('\n', asm_out_file); ASM_OUTPUT_PUSH_SECTION (asm_out_file, PUBNAMES_SECTION); ASM_OUTPUT_DWARF_DATA4 (asm_out_file, 0); - ASM_OUTPUT_DWARF_STRING (asm_out_file, ""); + ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file, ""); ASM_OUTPUT_POP_SECTION (asm_out_file); /* Generate the terminating entries for the .debug_aranges section. @@ -6003,6 +6020,12 @@ dwarfout_finish () ASM_OUTPUT_POP_SECTION (asm_out_file); } + + /* There should not be any pending types left at the end. We need + this now because it may not have been checked on the last call to + dwarfout_file_scope_decl. */ + if (pending_types != 0) + abort (); } #endif /* DWARF_DEBUGGING_INFO */ |