[Libreoffice-commits] core.git: solenv/gdb
Jan-Marek Glogowski
glogow at fbihome.de
Fri Nov 15 13:03:28 PST 2013
solenv/gdb/boost/lib/unordered.py | 5 +++--
solenv/gdb/boost/ptr_container.py | 17 +++++++++--------
solenv/gdb/boost/unordered.py | 9 +++++----
solenv/gdb/boost/util/printing.py | 3 ++-
solenv/gdb/libreoffice/basegfx.py | 9 +++++----
solenv/gdb/libreoffice/cppu.py | 6 ++++--
solenv/gdb/libreoffice/sal.py | 3 ++-
solenv/gdb/libreoffice/svl.py | 5 +++--
solenv/gdb/libreoffice/sw.py | 5 +++--
solenv/gdb/libreoffice/tl.py | 5 +++--
solenv/gdb/libreoffice/util/printing.py | 3 ++-
solenv/gdb/libreoffice/util/uno.py | 17 +++++++++--------
12 files changed, 50 insertions(+), 37 deletions(-)
New commits:
commit c5b7cc9598f4a9a5c7c42c1ccd06765dc17b4c24
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Thu Nov 14 12:14:29 2013 +0100
Add Python 3 compatibility to GDB pretty printers.
GDB on *buntu is linked against Python 3.3, which has many
incompatibilities to Python 2, resulting in broken code.
This patch uses the Python six library as a compatibility layer.
Change-Id: Icb4cc54a1d05afb119376bb5e1430c91cb794d08
Reviewed-on: https://gerrit.libreoffice.org/6688
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/solenv/gdb/boost/lib/unordered.py b/solenv/gdb/boost/lib/unordered.py
index eecfa79..ee58d04 100644
--- a/solenv/gdb/boost/lib/unordered.py
+++ b/solenv/gdb/boost/lib/unordered.py
@@ -19,6 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import gdb
+import six
class Unordered(object):
'''Common representation of Boost.Unordered types'''
@@ -57,7 +58,7 @@ class Unordered(object):
assert node_type != None
return node_type
- class _iterator(object):
+ class _iterator(six.Iterator):
'''Iterator for Boost.Unordered types'''
def __init__(self, first_bucket, last_bucket, node_type, extractor):
@@ -71,7 +72,7 @@ class Unordered(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.node:
self.node = self.node.dereference()['next_']
diff --git a/solenv/gdb/boost/ptr_container.py b/solenv/gdb/boost/ptr_container.py
index 9e9a66f..38f3b2f 100644
--- a/solenv/gdb/boost/ptr_container.py
+++ b/solenv/gdb/boost/ptr_container.py
@@ -20,6 +20,7 @@
import gdb
+import six
from boost.lib.unordered import Map, Set
@@ -59,7 +60,7 @@ class PtrStdPrinterBase(object):
def children(self):
return self._iterator(self.sequence, self.value.type.template_argument(0))
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, sequence, type):
self.impl = iter(sequence)
@@ -68,7 +69,7 @@ class PtrStdPrinterBase(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
(index, value) = self.impl.next()
return (index, value.cast(self.type).dereference())
@@ -124,7 +125,7 @@ class PtrMapPrinter(PtrStdPrinterBase):
type = self.value.type
return self._iterator(self.sequence, type.template_argument(0), type.template_argument(1))
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, sequence, key_type, value_type):
self.impl = iter(sequence)
@@ -135,7 +136,7 @@ class PtrMapPrinter(PtrStdPrinterBase):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
(index, value) = self.impl.next()
if self.key:
value = value.cast(self.key_type)
@@ -176,7 +177,7 @@ class PtrUnorderedMapPrinter(PtrBoostPrinterBase):
def display_hint(self):
return 'map'
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, impl, value_type):
self.impl = impl
@@ -187,7 +188,7 @@ class PtrUnorderedMapPrinter(PtrBoostPrinterBase):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.step:
self.value = self.impl.next()
value = self.value[0]
@@ -205,7 +206,7 @@ class PtrUnorderedSetPrinter(PtrBoostPrinterBase):
def display_hint(self):
return 'array'
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, impl, value_type):
self.impl = impl
@@ -214,7 +215,7 @@ class PtrUnorderedSetPrinter(PtrBoostPrinterBase):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
return ("", self.impl.next()[1].cast(self.value_type).dereference())
printer = None
diff --git a/solenv/gdb/boost/unordered.py b/solenv/gdb/boost/unordered.py
index a511424..c21d31a 100644
--- a/solenv/gdb/boost/unordered.py
+++ b/solenv/gdb/boost/unordered.py
@@ -20,6 +20,7 @@
import gdb
+import six
from boost.lib.unordered import Map, Set
@@ -50,7 +51,7 @@ class UnorderedMapPrinter(PrinterBase):
def display_hint(self):
return 'map'
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, impl):
self.impl = impl
@@ -60,7 +61,7 @@ class UnorderedMapPrinter(PrinterBase):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.step:
self.value = self.impl.next()
value = self.value[0]
@@ -77,7 +78,7 @@ class UnorderedSetPrinter(PrinterBase):
def display_hint(self):
return 'array'
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, impl):
self.impl = impl
@@ -85,7 +86,7 @@ class UnorderedSetPrinter(PrinterBase):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
return ("", self.impl.next()[1])
printer = None
diff --git a/solenv/gdb/boost/util/printing.py b/solenv/gdb/boost/util/printing.py
index b6d714e..1d5d0ba 100644
--- a/solenv/gdb/boost/util/printing.py
+++ b/solenv/gdb/boost/util/printing.py
@@ -22,6 +22,7 @@
from collections import Mapping
import gdb
import re
+import six
from boost.util.compatibility import use_gdb_printing
@@ -85,7 +86,7 @@ class FunctionLookup(Mapping):
return len(self.map)
def __getitem__(self, type):
- for (test, printer) in self.map.iteritems():
+ for (test, printer) in six.iteritems(self.map):
if test(type):
return printer
return None
diff --git a/solenv/gdb/libreoffice/basegfx.py b/solenv/gdb/libreoffice/basegfx.py
index 10381c1..ec564b9 100644
--- a/solenv/gdb/libreoffice/basegfx.py
+++ b/solenv/gdb/libreoffice/basegfx.py
@@ -8,6 +8,7 @@
#
import gdb
+import six
from libreoffice.util import printing
@@ -73,7 +74,7 @@ class B2DPolygonPrinter(object):
else:
return self._plainIterator(self._count(), self.value)
- class _plainIterator(object):
+ class _plainIterator(six.Iterator):
def __init__(self, count, value):
self.count = count
self.value = value
@@ -82,7 +83,7 @@ class B2DPolygonPrinter(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.index >= self.count:
raise StopIteration()
currPoint = gdb.parse_and_eval(
@@ -95,7 +96,7 @@ class B2DPolygonPrinter(object):
return ('point %d' % (self.index-1),
'(%15f, %15f)' % (currPoint['mfX'], currPoint['mfY']))
- class _bezierIterator(object):
+ class _bezierIterator(six.Iterator):
def __init__(self, count, value):
self.count = count
self.value = value
@@ -104,7 +105,7 @@ class B2DPolygonPrinter(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.index >= self.count:
raise StopIteration()
currPoint = gdb.parse_and_eval(
diff --git a/solenv/gdb/libreoffice/cppu.py b/solenv/gdb/libreoffice/cppu.py
index bc265ae..1ab2b6e 100644
--- a/solenv/gdb/libreoffice/cppu.py
+++ b/solenv/gdb/libreoffice/cppu.py
@@ -7,6 +7,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+import six
+
from libreoffice.util import printing
from libreoffice.util.uno import TypeClass, make_uno_type, uno_cast
@@ -58,7 +60,7 @@ class UnoReferencePrinter(object):
class UnoSequencePrinter(object):
'''Prints UNO Sequence'''
- class iterator(object):
+ class iterator(six.Iterator):
'''Sequence iterator'''
def __init__(self, first, size):
@@ -69,7 +71,7 @@ class UnoSequencePrinter(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.count == self.size:
raise StopIteration
count = self.count
diff --git a/solenv/gdb/libreoffice/sal.py b/solenv/gdb/libreoffice/sal.py
index 8b4f0cb..c2e8384 100644
--- a/solenv/gdb/libreoffice/sal.py
+++ b/solenv/gdb/libreoffice/sal.py
@@ -9,6 +9,7 @@
import gdb
import gdb.types
+import six
from libreoffice.util import printing
from libreoffice.util.string import StringPrinterHelper
@@ -86,7 +87,7 @@ class OslFileStatusPrinter(object):
if etype is not None:
pretty_etype = '<unknown type>' # in case it's not one of the fields
- for field_name, field_val in fields_to_enum_val.iteritems():
+ for field_name, field_val in six.iteritems(fields_to_enum_val):
if etype == field_val:
pretty_etype = self.pretty_file_type(field_name)
else:
diff --git a/solenv/gdb/libreoffice/svl.py b/solenv/gdb/libreoffice/svl.py
index 83fe609..31b4507 100644
--- a/solenv/gdb/libreoffice/svl.py
+++ b/solenv/gdb/libreoffice/svl.py
@@ -8,6 +8,7 @@
#
import gdb
+import six
from libreoffice.util import printing
@@ -30,7 +31,7 @@ class SvArrayPrinter(object):
def display_hint(self):
return 'array'
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, data, count):
self.data = data
@@ -41,7 +42,7 @@ class SvArrayPrinter(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.pos == self.count:
raise StopIteration()
diff --git a/solenv/gdb/libreoffice/sw.py b/solenv/gdb/libreoffice/sw.py
index b46c287..515718e 100644
--- a/solenv/gdb/libreoffice/sw.py
+++ b/solenv/gdb/libreoffice/sw.py
@@ -7,6 +7,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+import six
from libreoffice.util import printing
class SwPositionPrinter(object):
@@ -205,7 +206,7 @@ class BigPtrArrayPrinter(object):
return 'array'
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, array):
self.blocks = array['ppInf']
@@ -255,7 +256,7 @@ class BigPtrArrayPrinter(object):
return "\n[%4d] %s%s%s %s" % (self.pos, cur_indent, \
node, self.max_indent[len(cur_indent):], value)
- def next(self):
+ def __next__(self):
if self.pos == self.count:
raise StopIteration()
diff --git a/solenv/gdb/libreoffice/tl.py b/solenv/gdb/libreoffice/tl.py
index 15e5398..816de7b 100644
--- a/solenv/gdb/libreoffice/tl.py
+++ b/solenv/gdb/libreoffice/tl.py
@@ -8,6 +8,7 @@
#
import gdb
+import six
from libreoffice.util import printing
@@ -159,7 +160,7 @@ class TimePrinter(object):
def to_string(self):
return str(TimeImpl.parse(self.val))
-class IteratorHelper(object):
+class IteratorHelper(six.Iterator):
'''Implements a container iterator useable for both 'linear'
containers (like DynArray or List) and Tables
'''
@@ -179,7 +180,7 @@ class IteratorHelper(object):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
if self.pos == self.count:
raise StopIteration()
diff --git a/solenv/gdb/libreoffice/util/printing.py b/solenv/gdb/libreoffice/util/printing.py
index f28b255..9cbae30 100644
--- a/solenv/gdb/libreoffice/util/printing.py
+++ b/solenv/gdb/libreoffice/util/printing.py
@@ -10,6 +10,7 @@
from collections import Mapping
import gdb
import re
+import six
from libreoffice.util.compatibility import use_gdb_printing
@@ -73,7 +74,7 @@ class FunctionLookup(Mapping):
return len(self.map)
def __getitem__(self, type):
- for (test, printer) in self.map.iteritems():
+ for (test, printer) in six.iteritems(self.map):
if test(type):
return printer
return None
diff --git a/solenv/gdb/libreoffice/util/uno.py b/solenv/gdb/libreoffice/util/uno.py
index 37feddb..b92a817 100644
--- a/solenv/gdb/libreoffice/util/uno.py
+++ b/solenv/gdb/libreoffice/util/uno.py
@@ -9,6 +9,7 @@
import gdb
import re
+import six
class UnsupportedType(Exception):
'''Represents exception thrown when an unsupported UNO type(like
@@ -295,7 +296,7 @@ class CompoundType(Type):
self.typename = self.uno2cpp(self.tag)
self._type = full_type
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, count, types, names):
self.count = count
@@ -306,7 +307,7 @@ class CompoundType(Type):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
assert self.pos >= 0 and self.pos <= self.count
if self.pos == self.count:
raise StopIteration
@@ -349,7 +350,7 @@ class EnumType(Type):
self.typename = self.uno2cpp(self.tag)
self._type = full_type.cast(gdb.lookup_type('_typelib_EnumTypeDescription'))
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, count, values, names):
self.count = count
@@ -360,7 +361,7 @@ class EnumType(Type):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
assert self.pos >= 0 and self.pos <= self.count
if self.pos == self.count:
raise StopIteration
@@ -405,7 +406,7 @@ class InterfaceMethodType(InterfaceMemberType):
self.oneway = full_type['bOneWay']
self._type = full_type
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, count, values):
self.count = count
@@ -416,7 +417,7 @@ class InterfaceMethodType(InterfaceMemberType):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
assert self.pos >= 0 and self.pos <= self.count
if self.pos == self.count:
raise StopIteration
@@ -484,7 +485,7 @@ class InterfaceType(Type):
self.uik = full_type['aUik']
self._type = full_type
- class _iterator(object):
+ class _iterator(six.Iterator):
def __init__(self, count, values):
assert values
@@ -495,7 +496,7 @@ class InterfaceType(Type):
def __iter__(self):
return self
- def next(self):
+ def __next__(self):
assert self.pos >= 0 and self.pos <= self.count
pvalue = self.values[self.pos]
assert pvalue
More information about the Libreoffice-commits
mailing list