2017-12-08 04:31:26 +00:00
|
|
|
From a50b4f703227b1c8b2ceb0c4c7b058d51cbbb006 Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-rhbz1350436-type-printers-error.patch
|
|
|
|
|
|
|
|
FileName: gdb-rhbz1350436-type-printers-error.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Test 'info type-printers' Python error (RH BZ 1350436).
|
|
|
|
;;=fedoratest
|
|
|
|
|
2016-06-27 21:24:13 +00:00
|
|
|
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
|
2017-12-08 04:31:26 +00:00
|
|
|
---
|
|
|
|
gdb/testsuite/gdb.python/py-typeprint.cc | 6 ++++++
|
|
|
|
gdb/testsuite/gdb.python/py-typeprint.exp | 4 ++++
|
|
|
|
gdb/testsuite/gdb.python/py-typeprint.py | 24 ++++++++++++++++++++++--
|
|
|
|
3 files changed, 32 insertions(+), 2 deletions(-)
|
2016-06-27 21:24:13 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
|
|
|
|
index 9ab6c4643d..39079fbd3a 100644
|
|
|
|
--- a/gdb/testsuite/gdb.python/py-typeprint.cc
|
|
|
|
+++ b/gdb/testsuite/gdb.python/py-typeprint.cc
|
2016-06-27 21:24:13 +00:00
|
|
|
@@ -31,6 +31,12 @@ templ<basic_string> s;
|
|
|
|
|
|
|
|
basic_string bs;
|
|
|
|
|
|
|
|
+class Other
|
|
|
|
+{
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+Other ovar;
|
|
|
|
+
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
return 0;
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
|
|
|
|
index 28e505331f..75e502b15c 100644
|
|
|
|
--- a/gdb/testsuite/gdb.python/py-typeprint.exp
|
|
|
|
+++ b/gdb/testsuite/gdb.python/py-typeprint.exp
|
|
|
|
@@ -50,3 +50,7 @@ gdb_test_no_output "enable type-printer string"
|
2016-06-27 21:24:13 +00:00
|
|
|
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"
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
|
|
|
|
index cf9c1ce8b9..7e28df2b9e 100644
|
|
|
|
--- a/gdb/testsuite/gdb.python/py-typeprint.py
|
|
|
|
+++ b/gdb/testsuite/gdb.python/py-typeprint.py
|
2016-06-27 21:24:13 +00:00
|
|
|
@@ -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())
|
2017-12-08 04:31:26 +00:00
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|