From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27374 invoked by alias); 15 Aug 2007 19:14:58 -0000 Received: (qmail 26942 invoked by uid 22791); 15 Aug 2007 19:14:56 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Aug 2007 19:14:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A734F2A9E6F; Wed, 15 Aug 2007 15:14:48 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id x6KUkXzGymtF; Wed, 15 Aug 2007 15:14:48 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 54DCD2A9E9D; Wed, 15 Aug 2007 15:14:48 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 88FB9E7B54; Wed, 15 Aug 2007 12:18:34 -0700 (PDT) Date: Wed, 15 Aug 2007 19:14:00 -0000 From: Joel Brobecker To: Jerome Guitton Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] backtrace in mixed language applications Message-ID: <20070815191834.GK11498@adacore.com> References: <20070810100313.GA29799@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070810100313.GA29799@adacore.com> User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00317.txt.bz2 [I told Jerome about his attachments being encoded as video/dv] > 2007-08-10 Jerome Guitton > > * stack.c (backtrace_command_1): select the frame that we are > about to print. I'm uncertain about this one. I should have reviewed it when it was checked in our tree... > Index: stack.c > =================================================================== > RCS file: /cvs/src/src/gdb/stack.c,v > retrieving revision 1.150 > diff -u -p -r1.150 stack.c > --- stack.c 25 Jul 2007 00:28:25 -0000 1.150 > +++ stack.c 10 Aug 2007 09:41:20 -0000 > @@ -1104,12 +1104,14 @@ backtrace_command_1 (char *count_exp, in > struct frame_info *fi; > int count; > int i; > - struct frame_info *trailing; > + struct frame_info *trailing, *selected_frame; > int trailing_level; > > if (!target_has_stack) > error (_("No stack.")); > > + selected_frame = get_selected_frame (NULL); > + > /* The following code must do two things. First, it must set the > variable TRAILING to the frame from which we should start > printing. Second, it must set the variable count to the number > @@ -1177,6 +1179,10 @@ backtrace_command_1 (char *count_exp, in > { > QUIT; > > + /* Select the frame that we are printing, so that the parameters > + are displayed using the appropriate language. */ > + select_frame (fi); > + > /* Don't use print_stack_frame; if an error() occurs it probably > means further attempts to backtrace would fail (on the other > hand, perhaps the code does or could be fixed to make sure > @@ -1188,6 +1194,7 @@ backtrace_command_1 (char *count_exp, in > /* Save the last frame to check for error conditions. */ > trailing = fi; > } > + select_frame (selected_frame); I think this opens the chance for the debugger to change the selected frame if something goes wrong (or the user presses controlC), which is an unexpected side-effect. Also, I'm thinking this is the wrong place for doing this frame switch. How about doing it inside print_frame? I think this would make sure we cover all the cases where we print a frame, such as after an "up", "down", or a "frame" command. And I think the frame selection needs to be protected against error raising. What do others think? -- Joel