Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Felix Lee <felix.1@canids.net>
To: gdb-patches@sources.redhat.com
Subject: Re: backtrace changes current source location
Date: Tue, 26 Oct 2004 15:01:00 -0000	[thread overview]
Message-ID: <20041026150127.6ED3E54AAB5@stray.canids> (raw)
In-Reply-To: <20041026132924.GA26886@nevyn.them.org>  on Tue, 26 Oct 2004 09:29:24 EDT from Daniel Jacobowitz <drow@false.org>

patch for
    http://sources.redhat.com/ml/gdb/2004-10/msg00414.html

gdb/ChangeLog
2004-10-26  Felix Lee  <felix+log1@specifixinc.com>

        * stack.c (backtrace_command_1): Backtrace shouldn't
        change current source location.

gdb/testsuite/ChangeLog
2004-10-26  Felix Lee  <felix+log1@specifixinc.com>

        * 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
 #


       reply	other threads:[~2004-10-26 15:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20041026075115.4A2C354AAB5@stray.canids>
     [not found] ` <20041026132924.GA26886@nevyn.them.org>
     [not found]   ` <drow@false.org>
2004-10-26 15:01     ` Felix Lee [this message]
2004-10-27 17:35       ` Andrew Cagney
2004-10-27 17:40         ` Daniel Jacobowitz
2004-10-28  0:52         ` Felix Lee
2004-10-29 15:22           ` Andrew Cagney
2004-10-29 15:36             ` Daniel Jacobowitz
2004-10-29 22:07             ` Felix Lee
2004-10-30  0:02               ` Andrew Cagney
2004-10-30  3:28                 ` Felix Lee
2004-11-01  4:38                   ` Felix Lee
2004-11-01 16:04                     ` Andrew Cagney
2004-11-01 16:13                     ` Daniel Jacobowitz
2004-11-05  8:51     ` Felix Lee
2006-10-04 20:43     ` [patch] Pushing Inferior Function Arguments onto Stack on PowerPC64 machines David Edelsohn
2006-10-04 20:52       ` Daniel Jacobowitz
2005-08-15 13:37 Procedure for large drop? Paul Hilfinger
2005-08-15 14:15 ` Daniel Jacobowitz
2005-08-15 21:50   ` Paul Hilfinger
2005-08-16  2:36     ` Jason Molenda
2005-08-20 22:15   ` Paul Hilfinger
2005-08-22 19:00     ` Daniel Jacobowitz
2006-10-04 19:00 [patch] Pushing Inferior Function Arguments onto Stack on PowerPC64 machines janani
2006-10-04 19:11 ` Daniel Jacobowitz
2006-10-04 19:14   ` Daniel Jacobowitz
2006-10-04 20:19   ` Mark Kettenis
2006-10-04 20:27     ` Andreas Schwab
     [not found]   ` <OFE88464A1.C58B072A-ON872571FD.006ABA69-862571FD.006C7CFB@us.ibm.com>
2006-10-04 20:26     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041026150127.6ED3E54AAB5@stray.canids \
    --to=felix.1@canids.net \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox