From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24810 invoked by alias); 26 Oct 2004 15:01:31 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24755 invoked from network); 26 Oct 2004 15:01:29 -0000 Received: from unknown (HELO sire.mail.pas.earthlink.net) (207.217.120.182) by sourceware.org with SMTP; 26 Oct 2004 15:01:29 -0000 Received: from ip216-26-76-19.dsl.du.teleport.com ([216.26.76.19] helo=stray.canids) by sire.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 1CMSpE-0005Kt-00 for gdb-patches@sources.redhat.com; Tue, 26 Oct 2004 08:01:28 -0700 Received: from stray.canids (localhost.localdomain [127.0.0.1]) by stray.canids (Postfix) with ESMTP id 6ED3E54AAB5 for ; Tue, 26 Oct 2004 08:01:27 -0700 (PDT) From: Felix Lee To: gdb-patches@sources.redhat.com Subject: Re: backtrace changes current source location References: <20041026075115.4A2C354AAB5@stray.canids> <20041026132924.GA26886@nevyn.them.org> In-Reply-To: <20041026132924.GA26886@nevyn.them.org> on Tue, 26 Oct 2004 09:29:24 EDT from Daniel Jacobowitz Date: Tue, 26 Oct 2004 15:01:00 -0000 Message-Id: <20041026150127.6ED3E54AAB5@stray.canids> X-SW-Source: 2004-10/txt/msg00439.txt.bz2 patch for http://sources.redhat.com/ml/gdb/2004-10/msg00414.html gdb/ChangeLog 2004-10-26 Felix Lee * stack.c (backtrace_command_1): Backtrace shouldn't change current source location. gdb/testsuite/ChangeLog 2004-10-26 Felix Lee * gdb.base/break.exp: Add test for line number after backtrace. Index: gdb/stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.112 diff -u -p -r1.112 stack.c --- gdb/stack.c 3 Aug 2004 00:57:26 -0000 1.112 +++ gdb/stack.c 26 Oct 2004 14:59:06 -0000 @@ -1170,8 +1170,13 @@ backtrace_command_1 (char *count_exp, in fi && count--; i++, fi = get_prev_frame (fi)) { + struct symtab_and_line savesal; QUIT; + /* print_frame_info changes the current sal, which is not + useful behavior when user asks for a backtrace. */ + savesal = get_current_source_symtab_and_line (); + /* 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 @@ -1179,6 +1184,8 @@ backtrace_command_1 (char *count_exp, in print_frame_info (fi, 1, LOCATION, 1); if (show_locals) print_frame_local_vars (fi, 1, gdb_stdout); + + set_current_source_symtab_and_line (&savesal); } /* If we've stopped before the end, mention that. */ Index: gdb/testsuite/gdb.base/break.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v retrieving revision 1.19 diff -u -p -r1.19 break.exp --- gdb/testsuite/gdb.base/break.exp 9 Dec 2003 18:19:20 -0000 1.19 +++ gdb/testsuite/gdb.base/break.exp 26 Oct 2004 14:59:06 -0000 @@ -238,6 +238,21 @@ for {set i 6} {$i >= 1} {incr i -1} { "run until file:function($i) breakpoint" } +# make sure backtrace doesn't change current source location. + +gdb_test "set listsize 1" \ + ".*" \ + "set listsize 1" +gdb_test "list $bp_location7" \ + ".*" \ + "list before backtrace" +gdb_test "backtrace" \ + "\#0 factorial .*" \ + "backtrace at breakpoint" +gdb_test "list -1" \ + "$bp_location7\[\t ].*" \ + "list after backtrace" + # # Run until the breakpoint set at a quoted function #