* [RFA] restore "mt set python print-stack" for gdb 7.4
@ 2012-01-14 4:06 Doug Evans
2012-01-14 8:25 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2012-01-14 4:06 UTC (permalink / raw)
To: gdb-patches, brobecker; +Cc: marc.khouzam
Hi.
Eclipse used this command. It's gone now from the current Eclipse sources,
but some releases exist that use it.
In order to not break things for users we're going to add this
command back for 7.4 (but keep it out of cvs head).
I've made this command properly interact with the new
"set python print-stack" parameter even though the new
version uses an enum.
Tested with Eclipse 3.7.1, verified Eclipse debugging sessions
now properly start.
Regression tested on amd64-linux.
Joel, ok to check into the branch?
2012-01-13 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".
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.472.2.3
diff -u -p -r1.472.2.3 NEWS
--- NEWS 1 Jan 2012 21:47:08 -0000 1.472.2.3
+++ NEWS 14 Jan 2012 00:24:15 -0000
@@ -29,10 +29,11 @@
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: python/python.c
===================================================================
RCS file: /cvs/src/src/gdb/python/python.c,v
retrieving revision 1.79.2.3
diff -u -p -r1.79.2.3 python.c
--- python/python.c 6 Jan 2012 04:43:41 -0000 1.79.2.3
+++ python/python.c 14 Jan 2012 00:24:15 -0000
@@ -1104,6 +1104,58 @@ gdbpy_breakpoint_has_py_cond (struct bre
#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."),
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFA] restore "mt set python print-stack" for gdb 7.4
2012-01-14 4:06 [RFA] restore "mt set python print-stack" for gdb 7.4 Doug Evans
@ 2012-01-14 8:25 ` Joel Brobecker
2012-01-14 21:07 ` Doug Evans
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2012-01-14 8:25 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches, marc.khouzam
> Joel, ok to check into the branch?
Looks good to me!
> 2012-01-13 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".
[...]
> Index: NEWS
> ===================================================================
> RCS file: /cvs/src/src/gdb/NEWS,v
> retrieving revision 1.472.2.3
> diff -u -p -r1.472.2.3 NEWS
> --- NEWS 1 Jan 2012 21:47:08 -0000 1.472.2.3
> +++ NEWS 14 Jan 2012 00:24:15 -0000
> @@ -29,10 +29,11 @@
> 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.
I think we need to update the NEWS file on the HEAD as well.
I would resynchronize the contents of the "in GDB 7.4" section
on the HEAD with the above, and then add a small entry in
"since 7.4" to say that the deprecated command has now been
removed.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] restore "mt set python print-stack" for gdb 7.4
2012-01-14 8:25 ` Joel Brobecker
@ 2012-01-14 21:07 ` Doug Evans
0 siblings, 0 replies; 3+ messages in thread
From: Doug Evans @ 2012-01-14 21:07 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches, marc.khouzam
On Fri, Jan 13, 2012 at 8:05 PM, Joel Brobecker <brobecker@adacore.com> wrote:
> I think we need to update the NEWS file on the HEAD as well.
> I would resynchronize the contents of the "in GDB 7.4" section
> on the HEAD with the above, and then add a small entry in
> "since 7.4" to say that the deprecated command has now been
> removed.
Thanks. I committed this.
2012-01-14 Doug Evans <dje@google.com>
* NEWS: Update text for "maint set python print-stack".
It is deprecated in gdb 7.4 and deleted in 7.5.
Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.478
diff -u -p -r1.478 NEWS
--- NEWS 2 Jan 2012 02:28:56 -0000 1.478
+++ NEWS 14 Jan 2012 18:12:26 -0000
@@ -3,6 +3,10 @@
*** Changes since GDB 7.4
+* Python scripting
+
+ ** The "maint set python print-stack on|off" is now deleted.
+
* GDBserver now supports stdio connections.
E.g. (gdb) target remote | ssh myhost gdbserver - hello
@@ -37,10 +41,11 @@
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-14 18:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-14 4:06 [RFA] restore "mt set python print-stack" for gdb 7.4 Doug Evans
2012-01-14 8:25 ` Joel Brobecker
2012-01-14 21:07 ` Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox