Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix SPARC backtraces
@ 2004-03-04 10:10 Mark Kettenis
  2004-03-19  0:09 ` Mark Kettenis
  2004-03-19  0:09 ` Andrew Cagney
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Kettenis @ 2004-03-04 10:10 UTC (permalink / raw)
  To: gdb-patches

As discussed before on the list, this makes sure we do the full frame
analysis even if %fp is zero.  This makes us do proper backtraces if a
frameless function was called from the outermost frame.

Committed to mainline,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* sparc-tdep.c (sparc_frame_cache): Don't bail out if %fp is zero.
	Reorganize code a bit.

Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.149
diff -u -p -r1.149 sparc-tdep.c
--- sparc-tdep.c 7 Feb 2004 20:40:35 -0000 1.149
+++ sparc-tdep.c 4 Mar 2004 10:03:28 -0000
@@ -615,14 +615,6 @@ sparc_frame_cache (struct frame_info *ne
   cache = sparc_alloc_frame_cache ();
   *this_cache = cache;
 
-  /* In priciple, for normal frames, %fp (%i6) holds the frame
-     pointer, which holds the base address for the current stack
-     frame.  */
-
-  cache->base = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
-  if (cache->base == 0)
-    return cache;
-
   cache->pc = frame_func_unwind (next_frame);
   if (cache->pc != 0)
     {
@@ -632,10 +624,18 @@ sparc_frame_cache (struct frame_info *ne
 
   if (cache->frameless_p)
     {
-      /* We didn't find a valid frame, which means that CACHE->base
-	 currently holds the frame pointer for our calling frame.  */
-      cache->base = frame_unwind_register_unsigned (next_frame,
-						    SPARC_SP_REGNUM);
+      /* This function is frameless, so %fp (%i6) holds the frame
+         pointer for our calling frame.  Use %sp (%o6) as this frame's
+         base address.  */
+      cache->base =
+	frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM);
+    }
+  else
+    {
+      /* For normal frames, %fp (%i6) holds the frame pointer, the
+         base address for the current stack frame.  */
+      cache->base =
+	frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
     }
 
   return cache;


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

* Re: [PATCH] Fix SPARC backtraces
  2004-03-19  0:09 ` Andrew Cagney
@ 2004-03-05  5:11   ` Andrew Cagney
  2004-03-19  0:09   ` Mark Kettenis
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Cagney @ 2004-03-05  5:11 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> As discussed before on the list, this makes sure we do the full frame
> analysis even if %fp is zero.  This makes us do proper backtraces if a
> frameless function was called from the outermost frame.

Should this go on the branch?  It appears to make things more robust.

Andrew



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

* Re: [PATCH] Fix SPARC backtraces
  2004-03-19  0:09   ` Mark Kettenis
@ 2004-03-05 15:32     ` Mark Kettenis
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Kettenis @ 2004-03-05 15:32 UTC (permalink / raw)
  To: cagney; +Cc: gdb-patches

   Date: Fri, 05 Mar 2004 00:11:24 -0500
   From: Andrew Cagney <cagney@gnu.org>

   > As discussed before on the list, this makes sure we do the full frame
   > analysis even if %fp is zero.  This makes us do proper backtraces if a
   > frameless function was called from the outermost frame.

   Should this go on the branch?  It appears to make things more robust.

Shouldn't hurt, although from a user perspective it probably doesn't
matter that much, since the failure scenario only kicks in if you're
debugging "beyond main".

Anyway, committed the the branch now too.

Mark


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

* Re: [PATCH] Fix SPARC backtraces
  2004-03-19  0:09 ` Andrew Cagney
  2004-03-05  5:11   ` Andrew Cagney
@ 2004-03-19  0:09   ` Mark Kettenis
  2004-03-05 15:32     ` Mark Kettenis
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Kettenis @ 2004-03-19  0:09 UTC (permalink / raw)
  To: cagney; +Cc: gdb-patches

   Date: Fri, 05 Mar 2004 00:11:24 -0500
   From: Andrew Cagney <cagney@gnu.org>

   > As discussed before on the list, this makes sure we do the full frame
   > analysis even if %fp is zero.  This makes us do proper backtraces if a
   > frameless function was called from the outermost frame.

   Should this go on the branch?  It appears to make things more robust.

Shouldn't hurt, although from a user perspective it probably doesn't
matter that much, since the failure scenario only kicks in if you're
debugging "beyond main".

Anyway, committed the the branch now too.

Mark


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

* Re: [PATCH] Fix SPARC backtraces
  2004-03-04 10:10 [PATCH] Fix SPARC backtraces Mark Kettenis
  2004-03-19  0:09 ` Mark Kettenis
@ 2004-03-19  0:09 ` Andrew Cagney
  2004-03-05  5:11   ` Andrew Cagney
  2004-03-19  0:09   ` Mark Kettenis
  1 sibling, 2 replies; 6+ messages in thread
From: Andrew Cagney @ 2004-03-19  0:09 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> As discussed before on the list, this makes sure we do the full frame
> analysis even if %fp is zero.  This makes us do proper backtraces if a
> frameless function was called from the outermost frame.

Should this go on the branch?  It appears to make things more robust.

Andrew



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

* [PATCH] Fix SPARC backtraces
  2004-03-04 10:10 [PATCH] Fix SPARC backtraces Mark Kettenis
@ 2004-03-19  0:09 ` Mark Kettenis
  2004-03-19  0:09 ` Andrew Cagney
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Kettenis @ 2004-03-19  0:09 UTC (permalink / raw)
  To: gdb-patches

As discussed before on the list, this makes sure we do the full frame
analysis even if %fp is zero.  This makes us do proper backtraces if a
frameless function was called from the outermost frame.

Committed to mainline,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* sparc-tdep.c (sparc_frame_cache): Don't bail out if %fp is zero.
	Reorganize code a bit.

Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.149
diff -u -p -r1.149 sparc-tdep.c
--- sparc-tdep.c 7 Feb 2004 20:40:35 -0000 1.149
+++ sparc-tdep.c 4 Mar 2004 10:03:28 -0000
@@ -615,14 +615,6 @@ sparc_frame_cache (struct frame_info *ne
   cache = sparc_alloc_frame_cache ();
   *this_cache = cache;
 
-  /* In priciple, for normal frames, %fp (%i6) holds the frame
-     pointer, which holds the base address for the current stack
-     frame.  */
-
-  cache->base = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
-  if (cache->base == 0)
-    return cache;
-
   cache->pc = frame_func_unwind (next_frame);
   if (cache->pc != 0)
     {
@@ -632,10 +624,18 @@ sparc_frame_cache (struct frame_info *ne
 
   if (cache->frameless_p)
     {
-      /* We didn't find a valid frame, which means that CACHE->base
-	 currently holds the frame pointer for our calling frame.  */
-      cache->base = frame_unwind_register_unsigned (next_frame,
-						    SPARC_SP_REGNUM);
+      /* This function is frameless, so %fp (%i6) holds the frame
+         pointer for our calling frame.  Use %sp (%o6) as this frame's
+         base address.  */
+      cache->base =
+	frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM);
+    }
+  else
+    {
+      /* For normal frames, %fp (%i6) holds the frame pointer, the
+         base address for the current stack frame.  */
+      cache->base =
+	frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
     }
 
   return cache;


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

end of thread, other threads:[~2004-03-05 15:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-04 10:10 [PATCH] Fix SPARC backtraces Mark Kettenis
2004-03-19  0:09 ` Mark Kettenis
2004-03-19  0:09 ` Andrew Cagney
2004-03-05  5:11   ` Andrew Cagney
2004-03-19  0:09   ` Mark Kettenis
2004-03-05 15:32     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox