From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29914 invoked by alias); 20 Aug 2006 14:38:57 -0000 Received: (qmail 29901 invoked by uid 22791); 20 Aug 2006 14:38:56 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 20 Aug 2006 14:38:54 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k7KEcJCd031938; Sun, 20 Aug 2006 16:38:19 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6) with ESMTP id k7KEcJeQ005609; Sun, 20 Aug 2006 16:38:19 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.6/8.13.6/Submit) id k7KEcJho022644; Sun, 20 Aug 2006 16:38:19 +0200 (CEST) Date: Sun, 20 Aug 2006 16:50:00 -0000 Message-Id: <200608201438.k7KEcJho022644@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: drow@false.org CC: gdb-patches@sourceware.org In-reply-to: <20060819154646.GA25238@nevyn.them.org> (message from Daniel Jacobowitz on Sat, 19 Aug 2006 11:46:46 -0400) Subject: Re: [rfc, frame] Add backtrace stop reasons References: <20060819154646.GA25238@nevyn.them.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00140.txt.bz2 > Date: Sat, 19 Aug 2006 11:46:46 -0400 > From: Daniel Jacobowitz > > 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 > > * 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.