diff options
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 876e53f..82c9ccf 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "md5.h" #include "tree-pretty-print.h" +#include "print-rtl.h" #include "debug.h" #include "common/common-target.h" #include "langhooks.h" @@ -26210,6 +26211,22 @@ static bool maybe_at_text_label_p = true; /* One above highest N where .LVLN label might be equal to .Ltext0 label. */ static unsigned int first_loclabel_num_not_at_text_label; +/* Look ahead for a real insn, or for a begin stmt marker. */ + +static rtx_insn * +dwarf2out_next_real_insn (rtx_insn *loc_note) +{ + rtx_insn *next_real = NEXT_INSN (loc_note); + + while (next_real) + if (INSN_P (next_real)) + break; + else + next_real = NEXT_INSN (next_real); + + return next_real; +} + /* Called by the final INSN scan whenever we see a var location. We use it to drop labels in the right places, and throw the location in our lookup table. */ @@ -26258,7 +26275,7 @@ dwarf2out_var_location (rtx_insn *loc_note) loc_note = NULL; var_loc_p = false; - next_real = next_real_insn (call_insn); + next_real = dwarf2out_next_real_insn (call_insn); next_note = NULL; cached_next_real_insn = NULL; goto create_label; @@ -26288,11 +26305,12 @@ dwarf2out_var_location (rtx_insn *loc_note) || next_note->deleted () || ! NOTE_P (next_note) || (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION + && NOTE_KIND (next_note) != NOTE_INSN_BEGIN_STMT && NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION)) next_note = NULL; if (! next_real) - next_real = next_real_insn (loc_note); + next_real = dwarf2out_next_real_insn (loc_note); if (next_note) { @@ -26451,6 +26469,22 @@ create_label: newloc->label = last_postcall_label; } + if (var_loc_p && flag_debug_asm) + { + const char *name = NULL, *sep = " => ", *patstr = NULL; + if (decl && DECL_NAME (decl)) + name = IDENTIFIER_POINTER (DECL_NAME (decl)); + if (NOTE_VAR_LOCATION_LOC (loc_note)) + patstr = str_pattern_slim (NOTE_VAR_LOCATION_LOC (loc_note)); + else + { + sep = " "; + patstr = "RESET"; + } + fprintf (asm_out_file, "\t%s DEBUG %s%s%s\n", ASM_COMMENT_START, + name, sep, patstr); + } + last_var_location_insn = next_real; last_in_cold_section_p = in_cold_section_p; } |