]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Restore "mt set python print-stack on|off" for 7.4.
authorDoug Evans <dje@google.com>
Sat, 14 Jan 2012 18:04:05 +0000 (18:04 +0000)
committerDoug Evans <dje@google.com>
Sat, 14 Jan 2012 18:04:05 +0000 (18:04 +0000)
* NEWS: Update to indicate "mt set python print-stack" is deprecated,
but not deleted yet, and will be gone in gdb 7.5.
* python/python.c (maint_set_python_list, maint_show_python_list):
New global vars.
(maint_set_python, maint_show_python): New functions.
(gdbpy_should_print_stack_deprecated): New global var.
(set_maint_python_print_stack): New function.
(show_maint_python_print_stack): New function.
(_initialize_python): Define commands
"mt set python print-stack on|off" and ""mt show python print-stack".

gdb/ChangeLog
gdb/NEWS
gdb/python/python.c

index 030b32e90643efd40396b3216d2af09f4597b837..71410e49d6f8d00741a587ca015505f554146477 100644 (file)
@@ -1,3 +1,17 @@
+2012-01-14  Doug Evans  <dje@google.com>
+
+       Restore "mt set python print-stack on|off" for 7.4.
+       * NEWS: Update to indicate "mt set python print-stack" is deprecated,
+       but not deleted yet, and will be gone in gdb 7.5.
+       * python/python.c (maint_set_python_list, maint_show_python_list):
+       New global vars.
+       (maint_set_python, maint_show_python): New functions.
+       (gdbpy_should_print_stack_deprecated): New global var.
+       (set_maint_python_print_stack): New function.
+       (show_maint_python_print_stack): New function.
+       (_initialize_python): Define commands
+       "mt set python print-stack on|off" and ""mt show python print-stack".
+
 2012-01-13  Eli Zaretskii  <eliz@gnu.org>
 
        * gdb_curses.h (MOUSE_MOVED) [__MINGW32__]: Undefine before
index 33c3a4547781ab02573970c23a48d9f53f05bcf3..1c74efb9f97be0f437b578bb098acc90238757b8 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
      existing one.
 
   ** The "maint set python print-stack on|off" command has been
-     removed.  A new command: "set python print-stack
-     none|full|message" has replaced it.  Additionally, the default
-     for "print-stack" is now "message", which just prints the error
-     message without the stack trace.
+     deprecated and will be deleted in GDB 7.5.
+     A new command: "set python print-stack none|full|message" has
+     replaced it.  Additionally, the default for "print-stack" is
+     now "message", which just prints the error message without
+     the stack trace.
    
   ** A prompt substitution hook (prompt_hook) is now available to the
      Python API.
index 5212d4eb927aaacbdedad9e402caa9be276ff5f7..6611c82c8556a1ae88c2556f2d53a755c6395e3c 100644 (file)
@@ -1103,6 +1103,58 @@ gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj)
 
 #endif /* HAVE_PYTHON */
 
+\f
+/* Support for "mt set python print-stack on|off" is present in gdb 7.4
+   to not break Eclipse.
+   ref: https://bugs.eclipse.org/bugs/show_bug.cgi?id=367788.  */
+
+/* Lists for 'maint set python' commands.  */
+
+static struct cmd_list_element *maint_set_python_list;
+static struct cmd_list_element *maint_show_python_list;
+
+/* Function for use by 'maint set python' prefix command.  */
+
+static void
+maint_set_python (char *args, int from_tty)
+{
+  help_list (maint_set_python_list, "maintenance set python ",
+            class_deprecated, gdb_stdout);
+}
+
+/* Function for use by 'maint show python' prefix command.  */
+
+static void
+maint_show_python (char *args, int from_tty)
+{
+  cmd_show_list (maint_show_python_list, from_tty, "");
+}
+
+/* True if we should print the stack when catching a Python error,
+   false otherwise.  */
+static int gdbpy_should_print_stack_deprecated = 0;
+
+static void
+set_maint_python_print_stack (char *args, int from_tty,
+                             struct cmd_list_element *e)
+{
+  if (gdbpy_should_print_stack_deprecated)
+    gdbpy_should_print_stack = python_excp_full;
+  else
+    gdbpy_should_print_stack = python_excp_none;
+}
+
+static void
+show_maint_python_print_stack (struct ui_file *file, int from_tty,
+                              struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+                   _("The mode of Python stack printing on error is"
+                     " \"%s\".\n"),
+                   gdbpy_should_print_stack == python_excp_full
+                   ? "on" : "off");
+}
+
 \f
 
 /* Lists for 'set python' commands.  */
@@ -1159,6 +1211,34 @@ This command is only a placeholder.")
 #endif /* HAVE_PYTHON */
           );
 
+  add_prefix_cmd ("python", no_class, maint_show_python,
+                 _("Prefix command for python maintenance settings."),
+                 &maint_show_python_list, "maintenance show python ", 0,
+                 &maintenance_show_cmdlist);
+  add_prefix_cmd ("python", no_class, maint_set_python,
+                 _("Prefix command for python maintenance settings."),
+                 &maint_set_python_list, "maintenance set python ", 0,
+                 &maintenance_set_cmdlist);
+
+  add_setshow_boolean_cmd ("print-stack", class_maintenance,
+                          &gdbpy_should_print_stack_deprecated, _("\
+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."),
+                          set_maint_python_print_stack,
+                          show_maint_python_print_stack,
+                          &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."),