The numbering of traces in the .dwarf2 dump file is broken, for example:

Creating trace 0 : start at note 1
Creating trace 1 : start at note 51
Creating trace 2 : start at code_label 16
Creating trace 3 : start at code_label 23
Creating trace 4 : start at code_label 38
Creating trace 5 : start at code_label 29
Processing trace 0 : start at note 1
   saw edge from trace 0 to 0 (via fallthru 0)
        push trace 0 to worklist
Processing trace 0 : start at note 51
   saw edge from trace 0 to 1 (via jump_insn 11)
        push trace 1 to worklist
   saw edge from trace 0 to 2 (via jump_insn 13)
        push trace 2 to worklist
Processing trace 2 : start at code_label 23
   saw edge from trace 2 to 4 (via jump_insn 26)
        push trace 4 to worklist
   saw edge from trace 2 to 3 (via fallthru 0)
        push trace 3 to worklist
Processing trace 3 : start at code_label 38
   saw edge from trace 3 to 3 (via jump_insn 61)
Processing trace 4 : start at code_label 29
Processing trace 1 : start at code_label 16
   saw edge from trace 1 to 1 (via jump_insn 19)

Note the 2 "Processing trace 0" and the off-by-one discrepancy between the 
"Creating" and the "Processing" lines.

Tested on x86_64-suse-linux, applied on the mainline as obvious.


2014-10-06  Eric Botcazou  <ebotca...@adacore.com>

        * dwarf2cfi.c (create_pseudo_cfg): Fix trace numbering.


-- 
Eric Botcazou
Index: dwarf2cfi.c
===================================================================
--- dwarf2cfi.c	(revision 215843)
+++ dwarf2cfi.c	(working copy)
@@ -2763,7 +2763,7 @@ create_pseudo_cfg (void)
 	  memset (&ti, 0, sizeof (ti));
 	  ti.head = insn;
 	  ti.switch_sections = switch_sections;
-	  ti.id = trace_info.length () - 1;
+	  ti.id = trace_info.length ();
 	  trace_info.safe_push (ti);
 
 	  saw_barrier = false;
@@ -2781,7 +2781,7 @@ create_pseudo_cfg (void)
       dw_trace_info **slot;
 
       if (dump_file)
-	fprintf (dump_file, "Creating trace %u : start at %s %d%s\n", i,
+	fprintf (dump_file, "Creating trace %u : start at %s %d%s\n", tp->id,
 		 rtx_name[(int) GET_CODE (tp->head)], INSN_UID (tp->head),
 		 tp->switch_sections ? " (section switch)" : "");
 

Reply via email to