Bug 13329 - GDB silently ignores Python exceptions when "set python print-stack" is off
Summary: GDB silently ignores Python exceptions when "set python print-stack" is off
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.4
Assignee: Phil Muldoon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-21 08:38 UTC by Kevin Pouget
Modified: 2012-01-11 09:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Pouget 2011-10-21 08:38:31 UTC
class BP(gdb.Breakpoint):	
	def stop(self):
		raise ValueError

will silently fail if "set python print-stack" is off.

On Wed, Oct 19, 2011 at 10:56 PM, Tom Tromey <tromey@redhat.com> wrote:
> Kevin> I don't know if Python allows to do it, but i think it would be nice
> Kevin> to see something like:
>
>>> NameError: global name 'comp' is not define
>
> Kevin> which is the last line of a python stacktrace
>
> I think it could be done.
> We can always add more values for "maint set python print-stack".
Comment 1 Phil Muldoon 2011-10-24 13:39:36 UTC
I'll pick this up and investigate.  It seems selective (for example commands, functions, etc replicate and print the error correctly).

"maint set python print-stack" has been depreciated btw, in favor of "set/show python print-stack"
Comment 2 Phil Muldoon 2012-01-11 09:09:23 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	pmuldoon@sourceware.org	2011-12-16 15:55:40

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

Log message:
	2011-12-16  Phil Muldoon  <pmuldoon@redhat.com>
	
	* testsuite/gdb.python/py-function.exp: Change "on" to "full" for
	python print-stack.  Add set/show python print-stack
	off|full|message tests.
	
	2011-12-16  Phil Muldoon  <pmuldoon@redhat.com>
	
	* python/python.c: Define python_excp_enums.
	(eval_python_from_control_command): Do not call gdbpy_print_stack.
	(python_command): Ditto.
	(gdbpy_print_stack): Rewrite to use new enum constants.
	(maint_set_python): Remove function.
	(maint_show_python): Ditto.
	(_initialize_python): Do not add "maint" commands.  Add "set/show
	python print-stack commands".
	* NEWS: Update to reflect removal for "maint set/show
	print-stack"
	
	2011-12-16  Phil Muldoon  <pmuldoon@redhat.com>
	
	* doc/gdb.texinfo (Python Commands): Remove "maint set/show print
	stack".  Add documentation for "set/show python print-stack".