[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - solenv/gdb

Michael Stahl mstahl at redhat.com
Fri Jan 30 03:35:49 PST 2015


 solenv/gdb/libreoffice/sw.py |   37 ++++++++-----------------------------
 1 file changed, 8 insertions(+), 29 deletions(-)

New commits:
commit 42f57af89978053598a70d289347466deb19c052
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jan 28 17:13:15 2015 +0100

    gdb pretty printers: fix the sw::mark::IMark and SwModify printers
    
    If these are called on a value that is of a different type than what is
    checked in the children() method, nothing is printed except exceptions
    about non-existent _iterator.
    
    GDB can figure out the dynamic type itself and call the pretty printer
    only if it's actually a UnoMark so don't register it for IMark.
    
    Same thing for SwUnoCrsr, there is already a class for it.
    
    Change-Id: I00238f1e3f01741d607eec9d47671302b858b965
    (cherry picked from commit 218bd97b83238496a4d2b36d0a1edaca519cdde5)
    Reviewed-on: https://gerrit.libreoffice.org/14239
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/solenv/gdb/libreoffice/sw.py b/solenv/gdb/libreoffice/sw.py
index 97cba13..71445d5 100644
--- a/solenv/gdb/libreoffice/sw.py
+++ b/solenv/gdb/libreoffice/sw.py
@@ -89,8 +89,8 @@ class SwRectPrinter(object):
         children = [ ( 'point', point), ( 'size', size ) ]
         return children.__iter__()
 
-class SwIMarkPrinter(object):
-    '''Prints sw::mark::IMark.'''
+class SwUnoMarkPrinter(object):
+    '''Prints sw::mark::UnoMark.'''
 
     def __init__(self, typename, value):
         self.typename = typename
@@ -100,31 +100,11 @@ class SwIMarkPrinter(object):
         return "%s" % (self.typename)
 
     def children(self):
-        if str(self.value.dynamic_type) == "sw::mark::UnoMark":
-            unoMark = self.value.cast(self.value.dynamic_type)
-            pos1 = unoMark['m_pPos1']
-            pos2 = unoMark['m_pPos2']
-            children = [ ( 'pos1', pos1), ( 'pos2', pos2 ) ]
-            return children.__iter__()
-        else:
-            return self._iterator(self.value)
-
-class SwModifyPrinter(object):
-    '''Prints SwModify.'''
-
-    def __init__(self, typename, value):
-        self.typename = typename
-        self.value = value
-
-    def to_string(self):
-        return "%s" % (self.typename)
-
-    def children(self):
-        if str(self.value.dynamic_type) == "SwUnoCrsr":
-            unoCrsr = self.value.cast(self.value.dynamic_type)
-            return SwUnoCrsrPrinter(self.typename, unoCrsr).children()
-        else:
-            return self._iterator(self.value)
+        unoMark = self.value.cast(self.value.dynamic_type)
+        pos1 = unoMark['m_pPos1']
+        pos2 = unoMark['m_pPos2']
+        children = [ ( 'pos1', pos1), ( 'pos2', pos2 ) ]
+        return children.__iter__()
 
 class SwXTextRangeImplPrinter(object):
     '''Prints SwXTextRange::Impl.'''
@@ -313,11 +293,10 @@ def build_pretty_printers():
     printer.add('SwPaM', SwPaMPrinter)
     printer.add('SwUnoCrsr', SwUnoCrsrPrinter)
     printer.add('SwRect', SwRectPrinter)
-    printer.add('sw::mark::IMark', SwIMarkPrinter)
+    printer.add('sw::mark::UnoMark', SwUnoMarkPrinter)
     printer.add('SwXTextRange::Impl', SwXTextRangeImplPrinter)
     printer.add('sw::UnoImplPtr', SwUnoImplPtrPrinter)
     printer.add('SwXTextRange', SwXTextRangePrinter)
-    printer.add('SwModify', SwModifyPrinter)
     printer.add('SwXTextCursor::Impl', SwXTextCursorImplPrinter)
     printer.add('SwXTextCursor', SwXTextCursorPrinter)
 


More information about the Libreoffice-commits mailing list