Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jeff Johnston <jjohnstn@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA]: issue warnings for frame offenses
Date: Tue, 26 Oct 2004 21:22:00 -0000	[thread overview]
Message-ID: <417EBFF9.5060104@redhat.com> (raw)

[-- 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,

             reply	other threads:[~2004-10-26 21:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-26 21:22 Jeff Johnston [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=417EBFF9.5060104@redhat.com \
    --to=jjohnstn@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox