diff options
author | Richard Henderson <rth@redhat.com> | 2011-07-07 17:13:02 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2011-07-07 17:13:02 -0700 |
commit | 2867fa7cbdb7d75597ed0b28b257b1d76c014838 (patch) | |
tree | 0056030cf44469f5fbaa6a33544b15d4d682bd59 | |
parent | 7644b3c7f08daeec085f4dc2ba180dab5bc29d28 (diff) | |
download | gcc-2867fa7cbdb7d75597ed0b28b257b1d76c014838.zip gcc-2867fa7cbdb7d75597ed0b28b257b1d76c014838.tar.gz gcc-2867fa7cbdb7d75597ed0b28b257b1d76c014838.tar.bz2 |
Dump NOTE_INSN_CFI notes.
* dwarf2out.c (output_cfi_directive): Export. Add FILE parameter.
Handle some opcodes specially for debugging.
* print-rtl.c: Include dwarf2out.h
(print_rtx): Handle NOTE_INSN_CFI.
* Makefile.in (print-rtl.o): Update.
From-SVN: r176020
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 78 | ||||
-rw-r--r-- | gcc/dwarf2out.h | 2 | ||||
-rw-r--r-- | gcc/print-rtl.c | 9 |
5 files changed, 71 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bfa3eb7..f8097ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2011-07-07 Richard Henderson <rth@redhat.com> + * dwarf2out.c (output_cfi_directive): Export. Add FILE parameter. + Handle some opcodes specially for debugging. + * print-rtl.c: Include dwarf2out.h + (print_rtx): Handle NOTE_INSN_CFI. + * Makefile.in (print-rtl.o): Update. + +2011-07-07 Richard Henderson <rth@redhat.com> + * tree-pass.h (pass_dwarf2_frame): Declare. * passes.c (init_optimization_passes): Add it. * dwarf2cfi.c (dwarf2out_frame_debug): Make static. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 8b4a44e..0f4a73e 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2923,7 +2923,8 @@ rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) $(FLAGS_H) \ - $(BCONFIG_H) $(DIAGNOSTIC_H) cselib.h $(TREE_PASS_H) tree-pretty-print.h + $(BCONFIG_H) $(DIAGNOSTIC_H) cselib.h $(TREE_PASS_H) tree-pretty-print.h \ + dwarf2out.h rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) \ $(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) \ $(FLAGS_H) $(REGS_H) output.h $(TARGET_H) $(FUNCTION_H) $(TREE_H) \ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 337650d..44035d3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -822,8 +822,8 @@ output_cfi (dw_cfi_ref cfi, dw_fde_ref fde, int for_eh) /* Similar, but do it via assembler directives instead. */ -static void -output_cfi_directive (dw_cfi_ref cfi) +void +output_cfi_directive (FILE *f, dw_cfi_ref cfi) { unsigned long r, r2; @@ -837,83 +837,105 @@ output_cfi_directive (dw_cfi_ref cfi) case DW_CFA_set_loc: /* Should only be created by add_fde_cfi in a code path not followed when emitting via directives. The assembler is - going to take care of this for us. */ - gcc_unreachable (); + going to take care of this for us. But this routines is + also used for debugging dumps, so print something. */ + gcc_assert (f != asm_out_file); + fprintf (f, "\t.cfi_advance_loc\n"); + break; case DW_CFA_offset: case DW_CFA_offset_extended: case DW_CFA_offset_extended_sf: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n", + fprintf (f, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n", r, cfi->dw_cfi_oprnd2.dw_cfi_offset); break; case DW_CFA_restore: case DW_CFA_restore_extended: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_restore %lu\n", r); + fprintf (f, "\t.cfi_restore %lu\n", r); break; case DW_CFA_undefined: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_undefined %lu\n", r); + fprintf (f, "\t.cfi_undefined %lu\n", r); break; case DW_CFA_same_value: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_same_value %lu\n", r); + fprintf (f, "\t.cfi_same_value %lu\n", r); break; case DW_CFA_def_cfa: case DW_CFA_def_cfa_sf: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n", + fprintf (f, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n", r, cfi->dw_cfi_oprnd2.dw_cfi_offset); break; case DW_CFA_def_cfa_register: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_def_cfa_register %lu\n", r); + fprintf (f, "\t.cfi_def_cfa_register %lu\n", r); break; case DW_CFA_register: r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1); r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 1); - fprintf (asm_out_file, "\t.cfi_register %lu, %lu\n", r, r2); + fprintf (f, "\t.cfi_register %lu, %lu\n", r, r2); break; case DW_CFA_def_cfa_offset: case DW_CFA_def_cfa_offset_sf: - fprintf (asm_out_file, "\t.cfi_def_cfa_offset " + fprintf (f, "\t.cfi_def_cfa_offset " HOST_WIDE_INT_PRINT_DEC"\n", cfi->dw_cfi_oprnd1.dw_cfi_offset); break; case DW_CFA_remember_state: - fprintf (asm_out_file, "\t.cfi_remember_state\n"); + fprintf (f, "\t.cfi_remember_state\n"); break; case DW_CFA_restore_state: - fprintf (asm_out_file, "\t.cfi_restore_state\n"); + fprintf (f, "\t.cfi_restore_state\n"); break; case DW_CFA_GNU_args_size: - fprintf (asm_out_file, "\t.cfi_escape %#x,", DW_CFA_GNU_args_size); - dw2_asm_output_data_uleb128_raw (cfi->dw_cfi_oprnd1.dw_cfi_offset); - if (flag_debug_asm) - fprintf (asm_out_file, "\t%s args_size "HOST_WIDE_INT_PRINT_DEC, - ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset); - fputc ('\n', asm_out_file); + if (f == asm_out_file) + { + fprintf (f, "\t.cfi_escape %#x,", DW_CFA_GNU_args_size); + dw2_asm_output_data_uleb128_raw (cfi->dw_cfi_oprnd1.dw_cfi_offset); + if (flag_debug_asm) + fprintf (f, "\t%s args_size "HOST_WIDE_INT_PRINT_DEC, + ASM_COMMENT_START, cfi->dw_cfi_oprnd1.dw_cfi_offset); + fputc ('\n', f); + } + else + { + fprintf (f, "\t.cfi_GNU_args_size "HOST_WIDE_INT_PRINT_DEC "\n", + cfi->dw_cfi_oprnd1.dw_cfi_offset); + } break; case DW_CFA_GNU_window_save: - fprintf (asm_out_file, "\t.cfi_window_save\n"); + fprintf (f, "\t.cfi_window_save\n"); break; case DW_CFA_def_cfa_expression: + if (f != asm_out_file) + { + fprintf (f, "\t.cfi_def_cfa_expression ...\n"); + break; + } + /* FALLTHRU */ case DW_CFA_expression: - fprintf (asm_out_file, "\t.cfi_escape %#x,", cfi->dw_cfi_opc); + if (f != asm_out_file) + { + fprintf (f, "\t.cfi_cfa_expression ...\n"); + break; + } + fprintf (f, "\t.cfi_escape %#x,", cfi->dw_cfi_opc); output_cfa_loc_raw (cfi); - fputc ('\n', asm_out_file); + fputc ('\n', f); break; default: @@ -925,7 +947,7 @@ void dwarf2out_emit_cfi (dw_cfi_ref cfi) { if (dwarf2out_do_cfi_asm ()) - output_cfi_directive (cfi); + output_cfi_directive (asm_out_file, cfi); } /* Output CFIs from VEC, up to index UPTO, to bring current FDE to the @@ -1032,7 +1054,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, && cfi2->dw_cfi_opc != DW_CFA_restore_extended) { if (do_cfi_asm) - output_cfi_directive (cfi2); + output_cfi_directive (asm_out_file, cfi2); else output_cfi (cfi2, fde, for_eh); } @@ -1066,7 +1088,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, if (cfi_cfa) { if (do_cfi_asm) - output_cfi_directive (cfi_cfa); + output_cfi_directive (asm_out_file, cfi_cfa); else output_cfi (cfi_cfa, fde, for_eh); } @@ -1076,7 +1098,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, && cfi_args_size->dw_cfi_oprnd1.dw_cfi_offset) { if (do_cfi_asm) - output_cfi_directive (cfi_args_size); + output_cfi_directive (asm_out_file, cfi_args_size); else output_cfi (cfi_args_size, fde, for_eh); } @@ -1087,7 +1109,7 @@ output_cfis (cfi_vec vec, int upto, bool do_cfi_asm, return; } else if (do_cfi_asm) - output_cfi_directive (cfi); + output_cfi_directive (asm_out_file, cfi); else output_cfi (cfi, fde, for_eh); break; diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h index 7122dee..19bae4a 100644 --- a/gcc/dwarf2out.h +++ b/gcc/dwarf2out.h @@ -241,6 +241,8 @@ extern enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc (enum dwarf_call_frame_info cfi); +extern void output_cfi_directive (FILE *f, struct dw_cfi_struct *cfi); + extern void dwarf2out_decl (tree); extern void dwarf2out_emit_cfi (dw_cfi_ref cfi); diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index c20ff6c..d7fd73b 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pretty-print.h" #include "cselib.h" #include "tree-pass.h" +#include "dwarf2out.h" #endif static FILE *outfile; @@ -309,6 +310,14 @@ print_rtx (const_rtx in_rtx) #endif break; + case NOTE_INSN_CFI: +#ifndef GENERATOR_FILE + fputc ('\n', outfile); + output_cfi_directive (outfile, NOTE_CFI (in_rtx)); + fputc ('\t', outfile); +#endif + break; + default: break; } |