diff options
author | Jim Wilson <wilson@cygnus.com> | 1999-08-27 02:37:40 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1999-08-26 19:37:40 -0700 |
commit | b2244e22a0cee5b617bc0619e5f8c2b11e14b2e1 (patch) | |
tree | 848c61a91662d479d931045e6aee44b755d53d5a /gcc/dwarf2out.c | |
parent | 26612c795a5a069188b4a3019a0a92b7a442f141 (diff) | |
download | gcc-b2244e22a0cee5b617bc0619e5f8c2b11e14b2e1.zip gcc-b2244e22a0cee5b617bc0619e5f8c2b11e14b2e1.tar.gz gcc-b2244e22a0cee5b617bc0619e5f8c2b11e14b2e1.tar.bz2 |
Add support for defering line number table construction to assembler.
* dwarf2out.c (DWARF2_ASM_LINE_DEBUG_INFO): Add default definition.
(debug_dwarf): Add DWARF2_ASM_LINE_DEBUG_INFO support.
(dwarf2out_line, dwarf2out_finish): Likewise.
* tm.texi (DWARF2_ASM_LINE_DEBUG_INFO): Add documetation.
From-SVN: r28910
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index bcb9476..81792b5 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2237,6 +2237,11 @@ extern char *language_string; #define DWARF_ARANGES_HEADER_SIZE \ (DWARF_ROUND (2 * DWARF_OFFSET_SIZE + 4, PTR_SIZE * 2) - DWARF_OFFSET_SIZE) +/* The default is to have gcc emit the line number tables. */ +#ifndef DWARF2_ASM_LINE_DEBUG_INFO +#define DWARF2_ASM_LINE_DEBUG_INFO 0 +#endif + /* Define the architecture-dependent minimum instruction length (in bytes). In this implementation of DWARF, this field is used for information purposes only. Since GCC generates assembly language, we have @@ -4446,7 +4451,8 @@ debug_dwarf () { print_indent = 0; print_die (comp_unit_die, stderr); - print_dwarf_line_table (stderr); + if (! DWARF2_ASM_LINE_DEBUG_INFO) + print_dwarf_line_table (stderr); } /* Traverse the DIE, and add a sibling attribute if it may have the @@ -9850,7 +9856,27 @@ dwarf2out_line (filename, line) { function_section (current_function_decl); - if (DECL_SECTION_NAME (current_function_decl)) + if (DWARF2_ASM_LINE_DEBUG_INFO) + { + static char *lastfile; + + /* Emit the .file and .loc directives understood by GNU as. */ + if (lastfile == 0 || strcmp (filename, lastfile)) + { + fprintf (asm_out_file, "\t.file 0 \"%s\"\n", filename); + lastfile = filename; + } + + fprintf (asm_out_file, "\t.loc 0 %d 0\n", line); + + /* Indicate that line number info exists. */ + ++line_info_table_in_use; + + /* Indicate that multiple line number tables exist. */ + if (DECL_SECTION_NAME (current_function_decl)) + ++separate_line_info_table_in_use; + } + else if (DECL_SECTION_NAME (current_function_decl)) { register dw_separate_line_info_ref line_info; ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, SEPARATE_LINE_CODE_LABEL, @@ -10097,9 +10123,12 @@ dwarf2out_finish () /* Output the source line correspondence table. */ if (line_info_table_in_use > 1 || separate_line_info_table_in_use) { - fputc ('\n', asm_out_file); - ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION); - output_line_info (); + if (! DWARF2_ASM_LINE_DEBUG_INFO) + { + fputc ('\n', asm_out_file); + ASM_OUTPUT_SECTION (asm_out_file, DEBUG_LINE_SECTION); + output_line_info (); + } /* We can only use the low/high_pc attributes if all of the code was in .text. */ |