This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA]: issue warnings for frame offenses
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 26 Oct 2004 17:22:01 -0400
- Subject: [RFA]: issue warnings for frame offenses
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.
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,