binutils-gdb/gdb/python
Pedro Alves f23981e991 Eliminate UNSUPPORTED_ERROR.
I have a case that could use an exception for "unsupported feature".
I found UNSUPPORTED_ERROR, but looking deeper, I think as is, reusing
it for other things would be fragile.  E.g., if the Python script
sourced by source_script_from_stream triggers any other missing
functionality that would result in UNSUPPORTED_ERROR being propagated
out to source_script_from_stream, that would confuse the error for
Python not being built into GDB.

This patch thus redoes things a little.  Instead of using an exception
for the "No Python" scenario, check whether Python is configured in
before actually trying to source the file.  It adds a new function
instead of using #ifdef HAVE_PYTHON directly, as that is better at
avoiding bitrot, as both Python and !Python paths are visible to the
compiler this way.

Tested on Fedora 17, with and without Python.

gdb/
2013-12-12  Pedro Alves  <palves@redhat.com>

	* cli/cli-cmds.c (source_script_from_stream) Use have_python
	instead of catching UNSUPPORTED_ERROR.
	* exceptions.h (UNSUPPORTED_ERROR): Delete.
	* python/python.c (source_python_script) [!HAVE_PYTHON]: Internal
	error if called.
	* python/python.h (have_python): New static inline function.
2013-12-12 10:15:48 +00:00
..
lib/gdb Add pretty-printer for MPX bnd registers. 2013-11-20 14:42:53 +01:00
py-arch.c 2013-10-03 Phil Muldoon <pmuldoon@redhat.com> 2013-10-03 14:43:32 +00:00
py-auto-load.c Move .debug_gdb_script processing to auto-load.c. 2013-11-29 21:29:26 -08:00
py-block.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-bpevent.c * python/py-arch.c (arch_object_type): Use 2013-05-20 20:09:01 +00:00
py-breakpoint.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-cmd.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-continueevent.c * python/py-arch.c (arch_object_type): Use 2013-05-20 20:09:01 +00:00
py-event.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-event.h * python/py-arch.c (gdbpy_initialize_arch): Return 'int'. 2013-05-20 20:28:52 +00:00
py-events.h * python/py-arch.c (arch_object_type): Use 2013-05-20 20:09:01 +00:00
py-evtregistry.c * python/py-arch.c (gdbpy_initialize_arch): Use 2013-05-20 20:36:19 +00:00
py-evts.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-exitedevent.c * python/py-arch.c (arch_object_type): Use 2013-05-20 20:09:01 +00:00
py-finishbreakpoint.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-frame.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-framefilter.c 2013-08-29 Phil Muldoon <pmuldoon@redhat.com> 2013-08-29 10:06:18 +00:00
py-function.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-gdb-readline.c remove gdb_string.h 2013-11-18 13:29:00 -07:00
py-inferior.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-infthread.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-lazy-string.c * python/py-arch.c (gdbpy_initialize_arch): Return 'int'. 2013-05-20 20:28:52 +00:00
py-linetable.c off-by-one fix for py-linetable.c 2013-11-14 11:09:14 -07:00
py-newobjfileevent.c * python/py-arch.c (arch_object_type): Use 2013-05-20 20:09:01 +00:00
py-objfile.c Code cleanup: Add objfile_name accessor 2013-09-24 13:57:38 +00:00
py-param.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-prettyprint.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-progspace.c Code cleanup: Add objfile_name accessor 2013-09-24 13:57:38 +00:00
py-signalevent.c * python/py-arch.c (arch_object_type): Use 2013-05-20 20:09:01 +00:00
py-stopevent.c
py-stopevent.h
py-symbol.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-symtab.c 2013-11-11 Phil Muldoon <pmuldoon@redhat.com> 2013-11-11 19:49:45 +00:00
py-threadevent.c * python/py-threadevent.c (get_event_thread): Use 2013-05-20 20:10:03 +00:00
py-type.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-utils.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
py-value.c Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
python-config.py
python-internal.h Remove trailing whitespace. 2013-11-29 12:00:47 -08:00
python.c Eliminate UNSUPPORTED_ERROR. 2013-12-12 10:15:48 +00:00
python.h Eliminate UNSUPPORTED_ERROR. 2013-12-12 10:15:48 +00:00