Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: issue warnings for frame offenses
@ 2004-10-26 21:22 Jeff Johnston
  2004-10-26 21:30 ` Joel Brobecker
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Johnston @ 2004-10-26 21:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

The attached patch changes a few backtrace termination scenarios in frame.c to 
issue a warning and terminate the backtrace rather than use the error() 
function.  The change is being made to help out end-users that use macros with 
backtraces in them.  At present, there a number of platforms where backtraces 
through assembler code (e.g. glibc thread creation) cause backtraces to get 
somewhat lost.  When the frame code issues the error, any macro issuing the 
backtrace is terminated.  If an end-user is applying such a macro to all 
threads, it ends prematurely for no good reason.  With the change, the message 
is still issued and the backtrace is stopped.

Ok to commit?

2004-10-26  Jeff Johnston  <jjohnstn@redhat.com>

         * frame.c (get_prev_frame_1): Change inner frame and equivalent
         frame tests to issue a warning rather than an error.
         (get_prev_frame): When backtrace limit is exceeded, terminate
         with a warning rather than an error.


[-- Attachment #2: frame.patch --]
[-- Type: text/plain, Size: 1642 bytes --]

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.191
diff -u -p -r1.191 frame.c
--- frame.c	1 Sep 2004 14:13:33 -0000	1.191
+++ frame.c	26 Oct 2004 21:13:18 -0000
@@ -1036,14 +1036,20 @@ get_prev_frame_1 (struct frame_info *thi
   if (this_frame->next->level >= 0
       && this_frame->next->unwind->type != SIGTRAMP_FRAME
       && frame_id_inner (this_id, get_frame_id (this_frame->next)))
-    error ("Previous frame inner to this frame (corrupt stack?)");
+    {
+      warning ("Previous frame inner to this frame (corrupt stack?)");
+      return NULL;
+    }
 
   /* Check that this and the next frame are not identical.  If they
      are, there is most likely a stack cycle.  As with the inner-than
      test above, avoid comparing the inner-most and sentinel frames.  */
   if (this_frame->level > 0
       && frame_id_eq (this_id, get_frame_id (this_frame->next)))
-    error ("Previous frame identical to this frame (corrupt stack?)");
+    {
+      warning ("Previous frame identical to this frame (corrupt stack?)");
+      return NULL;
+    }
 
   /* Allocate the new frame but do not wire it in to the frame chain.
      Some (bad) code in INIT_FRAME_EXTRA_INFO tries to look along
@@ -1199,7 +1205,8 @@ get_prev_frame (struct frame_info *this_
 
   if (this_frame->level > backtrace_limit)
     {
-      error ("Backtrace limit of %d exceeded", backtrace_limit);
+      warning ("Backtrace limit of %d exceeded", backtrace_limit);
+      return NULL;
     }
 
   /* If we're already inside the entry function for the main objfile,

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

end of thread, other threads:[~2004-11-05 20:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-26 21:22 [RFA]: issue warnings for frame offenses Jeff Johnston
2004-10-26 21:30 ` Joel Brobecker
2004-11-04  0:09   ` Andrew Cagney
2004-11-04 16:29     ` Jeff Johnston
2004-11-04 18:28       ` Jeff Johnston
2004-11-04 23:06     ` Jeff Johnston
2004-11-05 15:49       ` Andrew Cagney
2004-11-05 20:35         ` Jeff Johnston

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