public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ia64 _Unwind_Backtrace
@ 2004-06-08 12:21 Jakub Jelinek
  2004-06-08 19:24 ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-06-08 12:21 UTC (permalink / raw)
  To: Jim Wilson; +Cc: gcc-patches

Hi!

_Unwind_Backtrace on ia64 happily goes through a frame with IP 0 and might
crash later.
        .save rp, r0
in _start is used to terminate the chain, so we should stop right there.
Without this patch, GCC assumes there is a leaf function without unwind info
at address 0.
I looked at libunwind and it special cases RP == 0 as well.
Ok for 3.3/3.4/HEAD?

2004-06-08  Jakub Jelinek  <jakub@redhat.com>

	* config/ia64/unwind-ia64.c (uw_frame_state_for): Don't assume a
	leaf function without unwind info at RP 0.

--- gcc/config/ia64/unwind-ia64.c.jj	2004-04-01 18:43:56.000000000 +0200
+++ gcc/config/ia64/unwind-ia64.c	2004-06-08 10:26:50.673203249 +0200
@@ -1783,8 +1783,10 @@ uw_frame_state_for (struct _Unwind_Conte
 	 an unwind table entry.
 
 	 This can only happen in the frame after unwinding through a signal
-	 handler.  Avoid infinite looping by requiring that B0 != RP.  */
-      if (context->br_loc[0] && *context->br_loc[0] != context->rp)
+	 handler.  Avoid infinite looping by requiring that B0 != RP.
+	 RP == 0 terminates the chain.  */
+      if (context->br_loc[0] && *context->br_loc[0] != context->rp
+	  && context->rp != 0)
 	{
 	  fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_BR;
 	  fs->curr.reg[UNW_REG_RP].when = -1;

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ia64 _Unwind_Backtrace
  2004-06-08 12:21 [PATCH] Fix ia64 _Unwind_Backtrace Jakub Jelinek
@ 2004-06-08 19:24 ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2004-06-08 19:24 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Mon, 2004-06-07 at 23:19, Jakub Jelinek wrote:
> 	* config/ia64/unwind-ia64.c (uw_frame_state_for): Don't assume a
> 	leaf function without unwind info at RP 0.

OK for mainline and gcc-3.4.  For gcc-3.3, I think you need Gaby's
permission, but otherwise it is OK with me.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-08 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-08 12:21 [PATCH] Fix ia64 _Unwind_Backtrace Jakub Jelinek
2004-06-08 19:24 ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).