This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix to debugging problem on Alpha
On Mon, May 22, 2000 at 07:09:05PM -0700, Richard Henderson wrote:
> Namely, in thread_prologue_epilogue_insns, after emitting the
> prologue, move all of the line number notes after the prologue.
Like so.
I'll leave it to you to revert your patch. If you don't do so,
please fix alpha_align_insns, which is broken by your change.
r~
* function.c (thread_prologue_and_epilogue_insns): Make sure
existing line number notes appear after the prologue.
Index: function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -c -p -d -r1.197 -r1.198
*** function.c 2000/05/17 08:15:25 1.197
--- function.c 2000/05/23 03:40:53 1.198
*************** void
*** 6812,6826 ****
thread_prologue_and_epilogue_insns (f)
rtx f ATTRIBUTE_UNUSED;
{
! int insertted = 0;
edge e;
rtx seq;
#ifdef HAVE_prologue
if (HAVE_prologue)
{
- rtx insn;
-
start_sequence ();
seq = gen_prologue();
emit_insn (seq);
--- 6812,6827 ----
thread_prologue_and_epilogue_insns (f)
rtx f ATTRIBUTE_UNUSED;
{
! int inserted = 0;
edge e;
rtx seq;
+ #ifdef HAVE_prologue
+ rtx prologue_end = NULL_RTX;
+ #endif
#ifdef HAVE_prologue
if (HAVE_prologue)
{
start_sequence ();
seq = gen_prologue();
emit_insn (seq);
*************** thread_prologue_and_epilogue_insns (f)
*** 6829,6854 ****
if (GET_CODE (seq) != SEQUENCE)
seq = get_insns ();
record_insns (seq, &prologue);
! emit_note (NULL, NOTE_INSN_PROLOGUE_END);
!
! /* GDB handles `break f' by setting a breakpoint on the first
! line note *after* the prologue. That means that we should
! insert a line note here; otherwise, if the next line note
! comes part way into the next block, GDB will skip all the way
! to that point. */
! insn = next_nonnote_insn (f);
! while (insn)
! {
! if (GET_CODE (insn) == NOTE
! && NOTE_LINE_NUMBER (insn) >= 0)
! {
! emit_line_note_force (NOTE_SOURCE_FILE (insn),
! NOTE_LINE_NUMBER (insn));
! break;
! }
!
! insn = PREV_INSN (insn);
! }
seq = gen_sequence ();
end_sequence ();
--- 6830,6836 ----
if (GET_CODE (seq) != SEQUENCE)
seq = get_insns ();
record_insns (seq, &prologue);
! prologue_end = emit_note (NULL, NOTE_INSN_PROLOGUE_END);
seq = gen_sequence ();
end_sequence ();
*************** thread_prologue_and_epilogue_insns (f)
*** 6862,6868 ****
abort ();
insert_insn_on_edge (seq, ENTRY_BLOCK_PTR->succ);
! insertted = 1;
}
else
emit_insn_after (seq, f);
--- 6844,6850 ----
abort ();
insert_insn_on_edge (seq, ENTRY_BLOCK_PTR->succ);
! inserted = 1;
}
else
emit_insn_after (seq, f);
*************** thread_prologue_and_epilogue_insns (f)
*** 6977,6983 ****
seq = gen_sequence ();
end_sequence ();
insert_insn_on_edge (seq, e);
! insertted = 1;
}
goto epilogue_done;
}
--- 6959,6965 ----
seq = gen_sequence ();
end_sequence ();
insert_insn_on_edge (seq, e);
! inserted = 1;
}
goto epilogue_done;
}
*************** thread_prologue_and_epilogue_insns (f)
*** 7011,7022 ****
end_sequence();
insert_insn_on_edge (seq, e);
! insertted = 1;
}
#endif
epilogue_done:
! if (insertted)
commit_edge_insertions ();
#ifdef HAVE_sibcall_epilogue
--- 6993,7004 ----
end_sequence();
insert_insn_on_edge (seq, e);
! inserted = 1;
}
#endif
epilogue_done:
! if (inserted)
commit_edge_insertions ();
#ifdef HAVE_sibcall_epilogue
*************** epilogue_done:
*** 7047,7052 ****
--- 7029,7082 ----
avoid getting rid of sibcall epilogue insns. */
record_insns (GET_CODE (seq) == SEQUENCE
? seq : newinsn, &sibcall_epilogue);
+ }
+ #endif
+
+ #ifdef HAVE_prologue
+ if (prologue_end)
+ {
+ rtx insn, prev;
+
+ /* GDB handles `break f' by setting a breakpoint on the first
+ line note *after* the prologue. Which means (1) that if
+ there are line number notes before where we inserted the
+ prologue we should move them, and (2) if there is no such
+ note, then we should generate one at the prologue. */
+
+ for (insn = prologue_end; insn ; insn = prev)
+ {
+ prev = PREV_INSN (insn);
+ if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+ {
+ /* Note that we cannot reorder the first insn in the
+ chain, since rest_of_compilation relies on that
+ remaining constant. Do the next best thing. */
+ if (prev == NULL)
+ {
+ emit_line_note_after (NOTE_SOURCE_FILE (insn),
+ NOTE_LINE_NUMBER (insn),
+ prologue_end);
+ NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ }
+ else
+ reorder_insns (insn, insn, prologue_end);
+ }
+ }
+
+ insn = NEXT_INSN (prologue_end);
+ if (! insn || GET_CODE (insn) != NOTE || NOTE_LINE_NUMBER (insn) <= 0)
+ {
+ for (insn = next_active_insn (f); insn ; insn = PREV_INSN (insn))
+ {
+ if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
+ {
+ emit_line_note_after (NOTE_SOURCE_FILE (insn),
+ NOTE_LINE_NUMBER (insn),
+ prologue_end);
+ break;
+ }
+ }
+ }
}
#endif
}