6417cfc
2005-12-01  Jeff Johnston  <jjohnstn@redhat.com>
6417cfc
6417cfc
	* frame.c (backtrace_past_zero_pc): New static variable.
6417cfc
	(get_prev_frame): Don't return NULL for zero pc value if
6417cfc
	backtrace past-zero-frame option is turned on.
6417cfc
	(_initialize_frame): Initialize new command to allow backtracing
6417cfc
	past a zero pc value (set backtrace past-zero-pc).
6417cfc
6417cfc
testsuite/gdb.base:
6417cfc
2005-12-01  Jeff Johnston  <jjohnstn@redhat.com>
6417cfc
6417cfc
	* setshow.exp: Add testing of "set backtrace past-zero-pc" option.
6417cfc
9231e41
Index: gdb-6.5/gdb/testsuite/gdb.base/setshow.exp
9231e41
===================================================================
9231e41
--- gdb-6.5.orig/gdb/testsuite/gdb.base/setshow.exp	2006-07-11 02:46:50.000000000 -0300
9231e41
+++ gdb-6.5/gdb/testsuite/gdb.base/setshow.exp	2006-07-11 02:47:24.000000000 -0300
6417cfc
@@ -1,4 +1,4 @@
6417cfc
-# Copyright 1992, 1994, 1996, 1997, 1998, 2001, 2003
6417cfc
+# Copyright 1992, 1994, 1996, 1997, 1998, 2001, 2003, 2005
6417cfc
 # Free Software Foundation, Inc.
6417cfc
 
6417cfc
 # This program is free software; you can redistribute it and/or modify
6417cfc
@@ -106,6 +106,16 @@ if { ![target_info exists use_gdb_stub] 
6417cfc
     delete_breakpoints
6417cfc
     gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
6417cfc
 }
6417cfc
+#test show backtrace past-zero-pc
6417cfc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "default show backtrace past-zero-pc (off)"
6417cfc
+#test set backtrace past-zero-pc on
6417cfc
+gdb_test "set backtrace past-zero-pc on" "" "set backtrace past-zero-pc on"
6417cfc
+#test show backtrace past-zero-pc
6417cfc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is on." "show backtrace past-zero-pc (on)"
6417cfc
+#test set backtrace past-zero-pc off
6417cfc
+gdb_test "set backtrace past-zero-pc off" "" "set backtrace past-zero-pc off"
6417cfc
+#test show backtrace past-zero-pc
6417cfc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "show backtrace past-zero-pc (off)"
6417cfc
 #test set check range on
6417cfc
 gdb_test "set check range on" "" "set check range on" 
6417cfc
 #test show check range on
9231e41
Index: gdb-6.5/gdb/frame.c
9231e41
===================================================================
9231e41
--- gdb-6.5.orig/gdb/frame.c	2006-07-11 02:46:50.000000000 -0300
9231e41
+++ gdb-6.5/gdb/frame.c	2006-07-11 02:51:20.000000000 -0300
9231e41
@@ -131,6 +131,16 @@ Whether backtraces should continue past 
9231e41
 		    value);
9231e41
 }
6417cfc
 
6417cfc
+static int backtrace_past_zero_pc;
9231e41
+static void
9231e41
+show_backtrace_past_zero_pc (struct ui_file *file, int from_tty,
9231e41
+			     struct cmd_list_element *c, const char *value)
9231e41
+{
9231e41
+  fprintf_filtered (file, _("\
9231e41
+Whether backtraces should continue past a zero pc value is %s.\n"),
9231e41
+		    value);
9231e41
+}
9231e41
+
9231e41
 static int backtrace_past_entry;
6417cfc
 static void
9231e41
 show_backtrace_past_entry (struct ui_file *file, int from_tty,
9231e41
@@ -1313,9 +1323,7 @@ get_prev_frame (struct frame_info *this_
6417cfc
     }
6417cfc
 
6417cfc
   if (this_frame->level > 0
6417cfc
-#if 0
6417cfc
-      && backtrace_past_zero_pc
6417cfc
-#endif
6417cfc
+      && !backtrace_past_zero_pc
6417cfc
       && get_frame_type (this_frame) == NORMAL_FRAME
6417cfc
       && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
6417cfc
       && get_frame_pc (this_frame) == 0)
9231e41
@@ -1629,6 +1637,17 @@ the rest of the stack trace."),
9231e41
 			   &set_backtrace_cmdlist,
6417cfc
 			   &show_backtrace_cmdlist);
6417cfc
 
6417cfc
+  add_setshow_boolean_cmd ("past-zero-pc", class_obscure,
9231e41
+ 			   &backtrace_past_zero_pc, _("\
9231e41
+Set whether backtraces should continue past a zero pc value."), _("\
9231e41
+Show whether backtraces should continue past a zero pc value."), _("\
6417cfc
+Normally GDB stops backtracing when it finds a zero pc.\n\
9231e41
+Set this variable if you need to see the rest of the stack trace."), 
9231e41
+ 			   NULL,
9231e41
+			   show_backtrace_past_zero_pc,
9231e41
+			   &set_backtrace_cmdlist,
9231e41
+ 			   &show_backtrace_cmdlist);
6417cfc
+
9231e41
   add_setshow_integer_cmd ("limit", class_obscure,
9231e41
 			   &backtrace_limit, _("\
9231e41
 Set an upper bound on the number of backtrace levels."), _("\