]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2011-07-11 Phil Muldoon <pmuldoon@redhat.com>
authorPhil Muldoon <pmuldoon@redhat.com>
Mon, 11 Jul 2011 13:07:38 +0000 (13:07 +0000)
committerPhil Muldoon <pmuldoon@redhat.com>
Mon, 11 Jul 2011 13:07:38 +0000 (13:07 +0000)
        PR python/12438
* python/python.c: Set gdbpy_should_print_stack default to off.
(set_python): Deprecate maint set python print-stack to
class_deprecate.
(_initialize_python): Deprecate maint set/show python print-stack.
Add new prefix command, python.  Add new setting, print-backtrace.
* NEWS: Document set python print-stack.  Document default change.

2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12438
* gdb.texinfo (Python Commands): Add deprecate note to maint
          set/show python print-stack.  Document set/show python
          print-backtrace.

2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12438
* gdb.python/python.exp: Add maint set/show python print-stack
          deprecated tests.  Add set/show python print-backtrace tests.

gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/python/python.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-function.exp
gdb/testsuite/gdb.python/py-prettyprint.exp
gdb/testsuite/gdb.python/python.exp

index 7d4b1a84c703b869f3252e930d674d8d4189fd16..71010f4d93b6cc37df907e816957fb4800e6c433 100644 (file)
@@ -1,3 +1,13 @@
+2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>
+
+        PR python/12438
+       * python/python.c: Set gdbpy_should_print_stack default to off.
+       (set_python): Deprecate maint set python print-stack to
+       class_deprecate.
+       (_initialize_python): Deprecate maint set/show python print-stack.
+       Add new prefix command, python.  Add new setting, print-backtrace.
+       * NEWS: Document set python print-stack.  Document default change.
+
 2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>
 
        * python/py-inferior.c (infpy_dealloc): New function.
index 99615d2f1ee4abce1d4ca1de30fe65f19810e7bb..22d5a9c2c4132825db9754453d46fb9d15cc3748 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,11 @@
 
 *** Changes since GDB 7.3
 
+* The "maint set python print-stack on|off" command has been
+  deprecated, and a new command: "set python print-stack on|off" has
+  replaced it.  Additionally, the default for "print-stack" is now
+  "off".
+
 * libthread-db-search-path now supports two special values: $sdir and $pdir.
   $sdir specifies the default system locations of shared libraries.
   $pdir specifies the directory where the libpthread used by the application
index fa8042c4d5dc9e7bd43a91a53801cf470265d3d4..4a2d015d2b3da18875eecbda66ec05c304b6622f 100644 (file)
@@ -1,3 +1,10 @@
+2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>
+
+        PR python/12438
+       * gdb.texinfo (Python Commands): Add deprecate note to maint
+          set/show python print-stack.  Document set/show python
+          print-backtrace.
+
 2011-07-05  Thiago Jung Bauermann  <bauerman.ibm.com>
 
        * gdb.texinfo: Fix typos.
index 129a46ba981cccff7a2ac19c3db545224f146816..3a3a9fbf1974e7cbbd1522d6405a54cd8f3b42aa 100644 (file)
@@ -20801,10 +20801,15 @@ End with a line saying just "end".
 
 @kindex maint set python print-stack
 @item maint set python print-stack
-By default, @value{GDBN} will print a stack trace when an error occurs
-in a Python script.  This can be controlled using @code{maint set
-python print-stack}: if @code{on}, the default, then Python stack
-printing is enabled; if @code{off}, then Python stack printing is
+This command is now deprecated.  Instead use @code{set python
+print-stack} 
+
+@kindex set python print-stack
+@item set python print-stack
+By default, @value{GDBN} will not print a stack trace when an error
+occurs in a Python script.  This can be controlled using @code{set
+python print-stack}: if @code{on}, then Python stack printing is
+enabled; if @code{off}, the default, then Python stack printing is
 disabled.
 @end table
 
index ddfe9ba6332556140491254fedf80566526f5852..f15936dae3c049a715c675a1c178b6c95f40157e 100644 (file)
@@ -36,7 +36,7 @@
 
 /* True if we should print the stack when catching a Python error,
    false otherwise.  */
-static int gdbpy_should_print_stack = 1;
+static int gdbpy_should_print_stack = 0;
 
 #ifdef HAVE_PYTHON
 
@@ -936,23 +936,46 @@ gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj)
 
 /* Lists for 'maint set python' commands.  */
 
-struct cmd_list_element *set_python_list;
-struct cmd_list_element *show_python_list;
+static struct cmd_list_element *maint_set_python_list;
+static struct cmd_list_element *maint_show_python_list;
+
+/* Lists for 'set python' commands.  */
+
+static struct cmd_list_element *user_set_python_list;
+static struct cmd_list_element *user_show_python_list;
 
 /* Function for use by 'maint set python' prefix command.  */
 
 static void
-set_python (char *args, int from_tty)
+maint_set_python (char *args, int from_tty)
 {
-  help_list (set_python_list, "maintenance set python ", -1, gdb_stdout);
+  help_list (maint_set_python_list, "maintenance set python ",
+            class_deprecated, gdb_stdout);
 }
 
 /* Function for use by 'maint show python' prefix command.  */
 
 static void
-show_python (char *args, int from_tty)
+maint_show_python (char *args, int from_tty)
+{
+  cmd_show_list (maint_show_python_list, from_tty, "");
+}
+
+/* Function for use by 'set python' prefix command.  */
+
+static void
+user_set_python (char *args, int from_tty)
+{
+  help_list (user_set_python_list, "set python ", all_commands,
+            gdb_stdout);
+}
+
+/* Function for use by 'show python' prefix command.  */
+
+static void
+user_show_python (char *args, int from_tty)
 {
-  cmd_show_list (show_python_list, from_tty, "");
+  cmd_show_list (user_show_python_list, from_tty, "");
 }
 
 /* Initialize the Python code.  */
@@ -963,6 +986,9 @@ extern initialize_file_ftype _initialize_python;
 void
 _initialize_python (void)
 {
+  char *cmd_name;
+  struct cmd_list_element *cmd;
+
   add_com ("python", class_obscure, python_command,
 #ifdef HAVE_PYTHON
           _("\
@@ -984,13 +1010,13 @@ This command is only a placeholder.")
 #endif /* HAVE_PYTHON */
           );
 
-  add_prefix_cmd ("python", no_class, show_python,
+  add_prefix_cmd ("python", no_class, maint_show_python,
                  _("Prefix command for python maintenance settings."),
-                 &show_python_list, "maintenance show python ", 0,
+                 &maint_show_python_list, "maintenance show python ", 0,
                  &maintenance_show_cmdlist);
-  add_prefix_cmd ("python", no_class, set_python,
+  add_prefix_cmd ("python", no_class, maint_set_python,
                  _("Prefix command for python maintenance settings."),
-                 &set_python_list, "maintenance set python ", 0,
+                 &maint_set_python_list, "maintenance set python ", 0,
                  &maintenance_set_cmdlist);
 
   add_setshow_boolean_cmd ("print-stack", class_maintenance,
@@ -999,8 +1025,37 @@ Enable or disable printing of Python stack dump on error."), _("\
 Show whether Python stack will be printed on error."), _("\
 Enables or disables printing of Python stack traces."),
                           NULL, NULL,
-                          &set_python_list,
-                          &show_python_list);
+                          &maint_set_python_list,
+                          &maint_show_python_list);
+
+  /* Deprecate maint set/show python print-stack in favour of
+     non-maintenance alternatives.  */
+  cmd_name = "print-stack";
+  cmd = lookup_cmd (&cmd_name, maint_set_python_list, "", -1, 0);
+  deprecate_cmd (cmd, "set python print-stack");
+  cmd_name = "print-stack"; /* Reset name.  */
+  cmd = lookup_cmd (&cmd_name, maint_show_python_list, "", -1, 0);
+  deprecate_cmd (cmd, "show python print-stack");
+
+  /* Add set/show python print-stack.  */
+  add_prefix_cmd ("python", no_class, user_show_python,
+                 _("Prefix command for python preference settings."),
+                 &user_show_python_list, "show python ", 0,
+                 &showlist);
+
+  add_prefix_cmd ("python", no_class, user_set_python,
+                 _("Prefix command for python preference settings."),
+                 &user_set_python_list, "set python ", 0,
+                 &setlist);
+
+  add_setshow_boolean_cmd ("print-stack", no_class,
+                          &gdbpy_should_print_stack, _("\
+Enable or disable printing of Python stack dump on error."), _("\
+Show whether Python stack will be printed on error."), _("\
+Enables or disables printing of Python stack traces."),
+                          NULL, NULL,
+                          &user_set_python_list,
+                          &user_show_python_list);
 
 #ifdef HAVE_PYTHON
 #ifdef WITH_PYTHON_PATH
index 1f43ffe3c5301a72135a08294acafd93f374d121..bf29ba0a1974c5c1216f3d3dd02079e8d654016f 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>
+
+        PR python/12438
+       * gdb.python/python.exp: Add maint set/show python print-stack
+          deprecated tests.  Add set/show python print-backtrace tests.
+
 2011-07-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.java/jprint.exp (print a java.lang.String): xfail without system
index ffadb5b24233bfbf72ab97b59b272abb1930492e..d57943525afe1d8309d3b9c750bf4a91ca03b0ee 100644 (file)
@@ -93,6 +93,7 @@ gdb_py_test_multiple "Test Normal Error" \
   "NormalError ()" "" \
   "end" ""
 
+gdb_test_no_output "set python print-stack on"
 gdb_test "print \$normalerror()" "Traceback.*File.*line 5.*in invoke.*RuntimeError.*This is a Normal Error.*" \
     "Test a Runtime error.  There should be a stack trace."
 
index 1fd8c6f2ccc6f2791d1ae4d706bc62c530a47ed3..911725f6f25eae666da846c691ebe92f308d0e31 100644 (file)
@@ -97,6 +97,7 @@ proc run_lang_tests {lang} {
     gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
     gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
 
+    gdb_test_no_output "set python print-stack on"
     gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
 
     gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
index e0deb63faa6777b9a6670622209b2dd141af90a2..8906bbc97a36deb0ac060a2d77e2d36661568ca5 100644 (file)
@@ -178,3 +178,18 @@ gdb_test "python gdb.write(\"Foo\\n\")" "Foo" "Test default write"
 gdb_test "python gdb.write(\"Error stream\\n\", stream=gdb.STDERR)" "Error stream" "Test stderr write"
 gdb_test "python gdb.write(\"Normal stream\\n\", stream=gdb.STDOUT)" "Normal stream" "Test stdout write"
 gdb_test "python gdb.write(\"Log stream\\n\", stream=gdb.STDLOG)" "Log stream" "Test stdlog write"
+
+# Deprecate maint set/show python print-stack
+gdb_test "maint show python print-stack" \
+    "Warning: command 'maintenance show python print-stack' is deprecated.*Use 'show python print-stack'.*" \
+    "Test deprecation maint show warning."
+gdb_test "maint set python print-stack off" \
+    "Warning: command 'maintenance set python print-stack' is deprecated.*Use 'set python print-stack'.*" \
+    "Test deprecation maint set warning."
+gdb_test "show python print-stack" \
+    "Whether Python stack will be printed on error is off.*" \
+    "Test print-backtrace show setting. Default off."
+gdb_py_test_silent_cmd "set python print-stack on" \
+    "Test print-backtrace set setting" 1
+gdb_test "show python print-stack" \
+    "Whether Python stack will be printed on error is on.*" \