diff --git a/gdb-upstream.patch b/gdb-upstream.patch new file mode 100644 index 0000000..e2c1ff9 --- /dev/null +++ b/gdb-upstream.patch @@ -0,0 +1,120 @@ +http://sourceware.org/ml/gdb-cvs/2011-08/msg00047.html + +### src/gdb/ChangeLog 2011/08/08 21:41:12 1.13259 +### src/gdb/ChangeLog 2011/08/09 12:45:39 1.13260 +## -1,3 +1,13 @@ ++2011-08-09 Phil Muldoon ++ ++ * python/lib/gdb/__init__.py: Auto-load files in command and ++ function directories. ++ * python/python.c (finish_python_initialization): Use ++ os.path.join. ++ * python/lib/gdb/command/pretty_printers.py: Self register ++ command. ++ * NEWS: Document auto-loading. ++ + 2011-08-08 Jan Kratochvil + + * dwarf2loc.c (dwarf2_evaluate_loc_desc_full) +--- src/gdb/NEWS 2011/07/26 20:57:53 1.446 ++++ src/gdb/NEWS 2011/08/09 12:45:39 1.447 +@@ -1,6 +1,13 @@ + What has changed in GDB? + (Organized release by release) + ++*** Changes after GDB 7.3 ++ ++ ** Python commands and convenience-functions located in ++ 'data-directory'/python/gdb/command and ++ 'data-directory'/python/gdb/function are now automatically loaded ++ on GDB start-up. ++ + *** Changes in GDB 7.3 + + * GDB has a new command: "thread find [REGEXP]". +### src/gdb/doc/ChangeLog 2011/07/26 16:59:23 1.1202 +### src/gdb/doc/ChangeLog 2011/08/09 12:45:39 1.1203 +## -1,3 +1,8 @@ ++2011-08-09 Phil Muldoon ++ ++ * gdb.texinfo (Python): Document command and function ++ auto-loading. ++ + 2011-07-26 Jan Kratochvil + Eli Zaretskii + +--- src/gdb/doc/gdb.texinfo 2011/07/26 20:57:54 1.851 ++++ src/gdb/doc/gdb.texinfo 2011/08/09 12:45:39 1.852 +@@ -20845,6 +20845,12 @@ + is automatically added to the Python Search Path in order to allow + the Python interpreter to locate all scripts installed at this location. + ++Additionally, @value{GDBN} commands and convenience functions which ++are written in Python and are located in the ++@file{@var{data-directory}/python/gdb/command} or ++@file{@var{data-directory}/python/gdb/function} directories are ++automatically imported when @value{GDBN} starts. ++ + @menu + * Python Commands:: Accessing Python from @value{GDBN}. + * Python API:: Accessing @value{GDBN} from Python. +--- src/gdb/python/python.c 2011/07/22 09:22:50 1.68 ++++ src/gdb/python/python.c 2011/08/09 12:45:40 1.69 +@@ -1302,13 +1302,13 @@ + sys.path.insert (0, gdb.PYTHONDIR)\n\ + \n\ + # Tell python where to find submodules of gdb.\n\ +- gdb.__path__ = [gdb.PYTHONDIR + '/gdb']\n\ ++ gdb.__path__ = [os.path.join (gdb.PYTHONDIR, 'gdb')]\n\ + \n\ + # The gdb module is implemented in C rather than in Python. As a result,\n\ + # the associated __init.py__ script is not not executed by default when\n\ + # the gdb module gets imported. Execute that script manually if it\n\ + # exists.\n\ +- ipy = gdb.PYTHONDIR + '/gdb/__init__.py'\n\ ++ ipy = os.path.join (gdb.PYTHONDIR, 'gdb', '__init__.py')\n\ + if os.path.exists (ipy):\n\ + execfile (ipy)\n\ + \n\ +--- src/gdb/python/lib/gdb/__init__.py 2011/01/01 15:33:26 1.3 ++++ src/gdb/python/lib/gdb/__init__.py 2011/08/09 12:45:40 1.4 +@@ -13,6 +13,29 @@ + # You should have received a copy of the GNU General Public License + # along with this program. If not, see . + +-import gdb.command.pretty_printers ++import traceback + +-gdb.command.pretty_printers.register_pretty_printer_commands() ++# Auto-load all functions/commands. ++ ++# Modules to auto-load, and the paths where those modules exist. ++ ++module_dict = { ++ 'gdb.function': os.path.join(gdb.PYTHONDIR, 'gdb', 'function'), ++ 'gdb.command': os.path.join(gdb.PYTHONDIR, 'gdb', 'command') ++} ++ ++# Iterate the dictionary, collating the Python files in each module ++# path. Construct the module name, and import. ++ ++for module, location in module_dict.iteritems(): ++ if os.path.exists(location): ++ py_files = filter(lambda x: x.endswith('.py') and x != '__init__.py', ++ os.listdir(location)) ++ ++ for py_file in py_files: ++ # Construct from foo.py, gdb.module.foo ++ py_file = module + '.' + py_file[:-3] ++ try: ++ exec('import ' + py_file) ++ except: ++ print >> sys.stderr, traceback.format_exc() +--- src/gdb/python/lib/gdb/command/pretty_printers.py 2011/01/01 15:33:27 1.4 ++++ src/gdb/python/lib/gdb/command/pretty_printers.py 2011/08/09 12:45:40 1.5 +@@ -368,3 +368,5 @@ + InfoPrettyPrinter() + EnablePrettyPrinter() + DisablePrettyPrinter() ++ ++register_pretty_printer_commands() diff --git a/gdb.spec b/gdb.spec index 974a082..5c25290 100644 --- a/gdb.spec +++ b/gdb.spec @@ -27,7 +27,7 @@ Version: 7.3 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 41%{?_with_upstream:.upstream}%{?dist} +Release: 42%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain Group: Development/Debuggers @@ -260,7 +260,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. #Xdrop: Just backports. -#Patch232: gdb-upstream.patch +Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). #=fedoratest+ppc @@ -723,7 +723,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %if 0%{!?_with_upstream:1} -#patch232 -p1 +%patch232 -p1 %patch349 -p1 %patch1 -p1 %patch3 -p1 @@ -1265,6 +1265,9 @@ fi %{_infodir}/gdb.info* %changelog +* Tue Aug 16 2011 Jan Kratochvil - 7.3-42.fc15 +- Python command/function auto-loading (Phil Muldoon, BZ 730976). + * Tue Jul 26 2011 Jan Kratochvil - 7.3-41.fc15 - Rebase to the final FSF GDB 7.3 release. - Improve gcc-4.6 stdarg false prologue end workaround (GDB PR 12435 + GCC PR 47471).