This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc, frame] Add backtrace stop reasons


> Date: Sat, 19 Aug 2006 11:46:46 -0400
> From: Daniel Jacobowitz <drow@false.org>
> 
> I've been thinking some more about the conversation we had, on treating
> PC==0 as a frame terminator.  This patch and the next patch don't
> directly affect that, but they address the general issue Mark raised:
> letting the user know why a backtrace stopped.
> 
> This patch adds a list of "enum unwind_stop_reason".  When we try to
> unwind a frame and fail, we record the reason why we failed, rather
> than calling error.  Backtrace can then choose to stop silently or
> display the reason.  I preserved which reasons get displayed and which
> don't.  The zero frame PC check doesn't happen here, so an independent
> patch would be to move it here so that a reason is included, and
> another independent patch would be whether to treat it as an error
> condition or not.
> 
> A nice bonus, in my opinion: if the backtrace stops because unwinding
> detects an error or the end of the stack, "info frame" will explain
> why.  For instance:
> 
>   Stops backtrace: previous frame inner to this frame (corrupt stack?)

Is this really useful?  It adds an extra line to the "info frame"
output, which might mean that more useful information about the frame
scrolls of my screen :(.

> Any comments on this patch?  It doesn't have any major change on GDB's
> visible behavior; it changes one error to a printf, but that error was
> always wrapped in a catch_exceptions anyway, so this is unimportant.
> The text of the message on a corrupt stack is changed mildly; it says
> "Backtrace stopped: previous..." rather than just "Previous...".

That's a useful clarification I think.

The implementation looks good to me, but I don't see why we need this
functionality yet.  Can you hold on to this until we really need it?

> 2006-08-19  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* frame.c (struct frame_info): Add stop_reason.
> 	(get_prev_frame_1): Set stop_reason.  Don't call error for
> 	stop reasons.
> 	(get_frame_unwind_stop_reason, frame_stop_reason_string): New.
> 	* frame.h (enum unwind_stop_reason): New.
> 	(get_frame_unwind_stop_reason, frame_stop_reason_string): New
> 	prototypes.
> 	* stack.c (frame_info): Print the stop reason.
> 	(backtrace_command_1): Print the stop reason for errors.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]