Test 'info type-printers' Python error (RH BZ 1350436).

This commit is contained in:
Jan Kratochvil 2016-06-27 23:24:13 +02:00
parent 8e7b06e27c
commit fb74e3a749
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,73 @@
Typo in Python support breaks info type-printers command
https://bugzilla.redhat.com/show_bug.cgi?id=1350436
[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers
https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html
diff -dup -rup gdb-7.6.1/gdb/testsuite/gdb.python-orig/py-typeprint.cc gdb-7.6.1/gdb/testsuite/gdb.python/py-typeprint.cc
--- gdb-7.6.1/gdb/testsuite/gdb.python-orig/py-typeprint.cc 2013-01-01 07:41:26.000000000 +0100
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-typeprint.cc 2016-06-27 22:57:58.168642470 +0200
@@ -31,6 +31,12 @@ templ<basic_string> s;
basic_string bs;
+class Other
+{
+};
+
+Other ovar;
+
int main()
{
return 0;
diff -dup -rup gdb-7.6.1/gdb/testsuite/gdb.python-orig/py-typeprint.exp gdb-7.6.1/gdb/testsuite/gdb.python/py-typeprint.exp
--- gdb-7.6.1/gdb/testsuite/gdb.python-orig/py-typeprint.exp 2013-01-01 07:41:26.000000000 +0100
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-typeprint.exp 2016-06-27 22:58:13.846785208 +0200
@@ -51,3 +51,7 @@ gdb_test_no_output "enable type-printer
gdb_test "whatis bs" "string" "whatis with enabled printer"
gdb_test "whatis s" "templ<string>"
+
+gdb_test "info type-printers" "Type printers for \[^\r\n\]*/py-typeprint:\r\n *other\r\n.*" \
+ "info type-printers for other"
+gdb_test "whatis ovar" "type = Another"
diff -dup -rup gdb-7.6.1/gdb/testsuite/gdb.python-orig/py-typeprint.py gdb-7.6.1/gdb/testsuite/gdb.python/py-typeprint.py
--- gdb-7.6.1/gdb/testsuite/gdb.python-orig/py-typeprint.py 2013-01-01 07:41:26.000000000 +0100
+++ gdb-7.6.1/gdb/testsuite/gdb.python/py-typeprint.py 2016-06-27 22:57:58.169642479 +0200
@@ -15,7 +15,7 @@
import gdb
-class Recognizer(object):
+class StringRecognizer(object):
def __init__(self):
self.enabled = True
@@ -30,6 +30,26 @@ class StringTypePrinter(object):
self.enabled = True
def instantiate(self):
- return Recognizer()
+ return StringRecognizer()
gdb.type_printers.append(StringTypePrinter())
+
+class OtherRecognizer(object):
+ def __init__(self):
+ self.enabled = True
+
+ def recognize(self, type_obj):
+ if type_obj.tag == 'Other':
+ return 'Another'
+ return None
+
+class OtherTypePrinter(object):
+ def __init__(self):
+ self.name = 'other'
+ self.enabled = True
+
+ def instantiate(self):
+ return OtherRecognizer()
+
+import gdb.types
+gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter())

View File

@ -27,7 +27,7 @@ Version: 7.11.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: 75%{?dist}
Release: 76%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -538,6 +538,9 @@ Patch927: gdb-python-gil.patch
# Fix jit-reader.h for multi-lib.
Patch978: gdb-jit-reader-multilib.patch
# Test 'info type-printers' Python error (RH BZ 1350436).
Patch992: gdb-rhbz1350436-type-printers-error.patch
# Never kill PID on: gdb exec PID (Jan Kratochvil, RH BZ 1219747).
Patch1053: gdb-bz1219747-attach-kills.patch
@ -870,6 +873,7 @@ find -name "*.info*"|xargs rm -f
%patch925 -p1
%patch927 -p1
%patch978 -p1
%patch992 -p1
%patch1053 -p1
%patch1056 -p1
%patch1073 -p1
@ -1403,6 +1407,9 @@ then
fi
%changelog
* Mon Jun 27 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.11.1-76.fc24
- Test 'info type-printers' Python error (RH BZ 1350436).
* Mon Jun 6 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.11.1-75.fc24
- Rebase to released FSF GDB 7.11.1.