Register all available PythonGDB commands (BZ 752095).
Backport fix for crash in cp_scan_for_anonymous_namespace (Aleksandar Ristovski, BZ 750341).
This commit is contained in:
parent
4909b1573f
commit
b118370a37
|
@ -0,0 +1,79 @@
|
|||
Fix for https://bugzilla.redhat.com/show_bug.cgi?id=750341
|
||||
http://sourceware.org/ml/gdb-patches/2011-10/msg00570.html
|
||||
|
||||
|
||||
http://sourceware.org/ml/gdb-cvs/2011-10/msg00154.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/10/20 13:34:13 1.13446
|
||||
### src/gdb/ChangeLog 2011/10/20 20:06:11 1.13447
|
||||
## -1,3 +1,15 @@
|
||||
+2011-10-20 Aleksandar Ristovski <aristovski@qnx.com>
|
||||
+
|
||||
+ * cp-namespace.c (cp_scan_for_anonymous_namespaces): Changed function
|
||||
+ arguments by adding OBJFILE. Instead of getting objfile from
|
||||
+ symbol's symtab, use new argument OBJFILE.
|
||||
+ * cp-support.h (cp_scan_for_anonymous_namespaces): Changed function
|
||||
+ arguments by adding OBJFILE.
|
||||
+ * gdb/dwarf2read.c (new_symbol_full): Change call to
|
||||
+ cp_scan_for_anonymous_namespaces to match new signature.
|
||||
+ * gdb/stabsread.c (define_symbol): Change call to
|
||||
+ cp_scan_for_anonymous_namespaces to match new signature.
|
||||
+
|
||||
2011-10-20 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
PR python/13308
|
||||
--- src/gdb/cp-namespace.c 2011/06/29 22:05:15 1.54
|
||||
+++ src/gdb/cp-namespace.c 2011/10/20 20:06:13 1.55
|
||||
@@ -53,7 +53,8 @@
|
||||
anonymous namespace; if so, add an appropriate using directive. */
|
||||
|
||||
void
|
||||
-cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
|
||||
+cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
|
||||
+ struct objfile *const objfile)
|
||||
{
|
||||
if (SYMBOL_DEMANGLED_NAME (symbol) != NULL)
|
||||
{
|
||||
@@ -114,7 +115,7 @@ cp_scan_for_anonymous_namespaces (const
|
||||
namespace given by the previous component if there is
|
||||
one, or to the global namespace if there isn't. */
|
||||
cp_add_using_directive (dest, src, NULL, NULL,
|
||||
- &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
|
||||
+ &objfile->objfile_obstack);
|
||||
}
|
||||
/* The "+ 2" is for the "::". */
|
||||
previous_component = next_component + 2;
|
||||
--- src/gdb/cp-support.h 2011/08/18 16:17:38 1.45
|
||||
+++ src/gdb/cp-support.h 2011/10/20 20:06:13 1.46
|
||||
@@ -197,7 +197,8 @@
|
||||
const char *processing_current_prefix,
|
||||
int processing_has_namespace_info);
|
||||
|
||||
-extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol);
|
||||
+extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol,
|
||||
+ struct objfile *objfile);
|
||||
|
||||
extern struct symbol *cp_lookup_symbol_nonlocal (const char *name,
|
||||
const struct block *block,
|
||||
--- src/gdb/dwarf2read.c 2011/10/20 01:11:34 1.576
|
||||
+++ src/gdb/dwarf2read.c 2011/10/20 20:06:13 1.577
|
||||
@@ -11992,7 +11992,7 @@
|
||||
namespaces based on the demangled name. */
|
||||
if (!processing_has_namespace_info
|
||||
&& cu->language == language_cplus)
|
||||
- cp_scan_for_anonymous_namespaces (sym);
|
||||
+ cp_scan_for_anonymous_namespaces (sym, objfile);
|
||||
}
|
||||
return (sym);
|
||||
}
|
||||
--- src/gdb/stabsread.c 2011/05/18 16:30:36 1.138
|
||||
+++ src/gdb/stabsread.c 2011/10/20 20:06:14 1.139
|
||||
@@ -729,7 +729,7 @@
|
||||
SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile);
|
||||
|
||||
if (SYMBOL_LANGUAGE (sym) == language_cplus)
|
||||
- cp_scan_for_anonymous_namespaces (sym);
|
||||
+ cp_scan_for_anonymous_namespaces (sym, objfile);
|
||||
|
||||
}
|
||||
p++;
|
|
@ -0,0 +1,137 @@
|
|||
commit 6e962026419305ae6c540eb01a735cf7c2685c20
|
||||
Author: pmuldoon <pmuldoon>
|
||||
Date: Tue Aug 9 12:45:39 2011 +0000
|
||||
|
||||
2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
* 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-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
* gdb.texinfo (Python): Document command and function
|
||||
auto-loading.
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,13 @@
|
||||
+2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
+
|
||||
+ * 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 <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full) <DWARF_VALUE_STACK>
|
||||
--- a/gdb/NEWS
|
||||
+++ b/gdb/NEWS
|
||||
@@ -1,6 +1,13 @@
|
||||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
||||
+*** Changes after GDB 7.3.1
|
||||
+
|
||||
+** 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.1
|
||||
|
||||
* The build failure for NetBSD and OpenBSD targets have now been fixed.
|
||||
### a/gdb/doc/ChangeLog
|
||||
### b/gdb/doc/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
+
|
||||
+ * gdb.texinfo (Python): Document command and function
|
||||
+ auto-loading.
|
||||
+
|
||||
2011-07-26 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -20845,6 +20845,12 @@ This directory, known as the @dfn{python directory},
|
||||
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.
|
||||
--- a/gdb/python/lib/gdb/__init__.py
|
||||
+++ b/gdb/python/lib/gdb/__init__.py
|
||||
@@ -13,6 +13,29 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-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()
|
||||
--- a/gdb/python/lib/gdb/command/pretty_printers.py
|
||||
+++ b/gdb/python/lib/gdb/command/pretty_printers.py
|
||||
@@ -368,3 +368,5 @@ def register_pretty_printer_commands():
|
||||
InfoPrettyPrinter()
|
||||
EnablePrettyPrinter()
|
||||
DisablePrettyPrinter()
|
||||
+
|
||||
+register_pretty_printer_commands()
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -1302,13 +1302,13 @@ def GdbSetPythonDirectory (dir):\n\
|
||||
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\
|
16
gdb.spec
16
gdb.spec
|
@ -27,7 +27,7 @@ Version: 7.3.1
|
|||
|
||||
# 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: 45%{?_with_upstream:.upstream}%{?dist}
|
||||
Release: 46%{?_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
|
||||
|
@ -573,6 +573,13 @@ Patch629: gdb-vla-frame-set.patch
|
|||
Patch630: gdb-implptr-64bit-1of2.patch
|
||||
Patch631: gdb-implptr-64bit-2of2.patch
|
||||
|
||||
# Register all available PythonGDB commands (BZ 752095).
|
||||
Patch635: gdb-python-load-commands.patch
|
||||
|
||||
# Backport fix for crash in cp_scan_for_anonymous_namespace
|
||||
# (Aleksandar Ristovski, BZ 750341).
|
||||
Patch636: gdb-anon-namespace-crash.patch
|
||||
|
||||
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
|
||||
# --without-system-readline
|
||||
# Requires: readline%{?_isa}
|
||||
|
@ -853,6 +860,8 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
|||
%patch629 -p1
|
||||
%patch630 -p1
|
||||
%patch631 -p1
|
||||
%patch635 -p1
|
||||
%patch636 -p1
|
||||
|
||||
%patch393 -p1
|
||||
%patch335 -p1
|
||||
|
@ -1275,6 +1284,11 @@ fi
|
|||
%{_infodir}/gdb.info*
|
||||
|
||||
%changelog
|
||||
* Thu Nov 10 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.1-46.fc15
|
||||
- Register all available PythonGDB commands (BZ 752095).
|
||||
- Backport fix for crash in cp_scan_for_anonymous_namespace
|
||||
(Aleksandar Ristovski, BZ 750341).
|
||||
|
||||
* Thu Oct 27 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.1-45.fc15
|
||||
- Rebase to FSF GDB 7.3.1 release.
|
||||
- Fix `layout regs' (BZ 749379, PR 13073, Pedro Alves).
|
||||
|
|
Loading…
Reference in New Issue