[Libreoffice-commits] core.git: solenv/gdb

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 29 20:43:15 UTC 2021


 solenv/gdb/libreoffice/vcl.py |   31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

New commits:
commit a40334ef4deb03c207b7f959a0a9c93ef3e5c459
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jun 29 01:42:50 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Jun 29 22:42:42 2021 +0200

    Extend and fix Scheduler GDB printer
    
    Adds a pretty printer for the whole Scheduler context and fixes an
    off-by-one error when dumping the ImplSchedulerData singly-linked
    list.
    
    Change-Id: I94129fc164986b379f33854651ff6df766eff97f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118075
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/solenv/gdb/libreoffice/vcl.py b/solenv/gdb/libreoffice/vcl.py
index 6a99c9f21f7c..ee9634fd5efc 100644
--- a/solenv/gdb/libreoffice/vcl.py
+++ b/solenv/gdb/libreoffice/vcl.py
@@ -40,7 +40,7 @@ class ImplSchedulerDataPrinter(object):
                 task_type = "Timer"
             else:
                 task_type = "Task"
-            res = "{:7s}{:10s} active: {:6s}".format( task_type, str(task['mePriority']), str(task['mbActive']) )
+            res = "{:7s}{:10s} active: {:6s}".format( task_type, str(task['mePriority']).replace('TaskPriority::',''), str(task['mbActive']) )
             name = task['mpDebugName']
             if not name:
                 res = res + "   (task debug name not set)"
@@ -48,9 +48,9 @@ class ImplSchedulerDataPrinter(object):
                 res = "{} '{}' ({})".format(res, str(name.string()), str(task.dynamic_type))
             val_type = gdb.lookup_type(str( task.dynamic_type )).pointer()
             timer = gdbobj['mpTask'].cast( val_type )
-            if (task_type == "Timer"):
+            if task_type == "Timer":
                 res = "{}: {}ms".format(res, timer['mnTimeout'])
-            else:
+            elif task_type == "Idle":
                 assert 0 == timer['mnTimeout'], "Idle with timeout == {}".format( timer['mnTimeout'] )
             return res
         else:
@@ -76,7 +76,7 @@ class ImplSchedulerDataPrinter(object):
             return self
 
         def __next__(self):
-            if not self.value['mpNext']:
+            if not self.value:
                 raise StopIteration()
 
             pos = str(self.pos)
@@ -86,6 +86,28 @@ class ImplSchedulerDataPrinter(object):
 
             return (pos, name)
 
+class ImplSchedulerContextPrinter(object):
+
+    def __init__(self, typename, value):
+        self.typename = typename
+        self.value = value
+        self.prio = gdb.lookup_type('TaskPriority')
+
+    def to_string(self):
+        print('{')
+        if self.value['mnTimerPeriod']:
+            print('mnTimerPeriod =', self.value['mnTimerPeriod'])
+        if self.value['mpSchedulerStack']:
+            print('STACK', end =", ")
+            print(self.value['mpSchedulerStack'].dereference())
+        if self.value['mpFirstSchedulerData']:
+            for key, value in self.prio.items():
+                first = self.value['mpFirstSchedulerData'][value.enumval]
+                if first:
+                    print(key.replace('TaskPriority::', ''), end =", ")
+                    print(first.dereference())
+        print('}')
+
 printer = None
 
 def build_pretty_printers():
@@ -93,6 +115,7 @@ def build_pretty_printers():
 
     printer = printing.Printer("libreoffice/vcl")
     printer.add('ImplSchedulerData', ImplSchedulerDataPrinter)
+    printer.add('ImplSchedulerContext', ImplSchedulerContextPrinter)
 
 def register_pretty_printers(obj):
     printing.register_pretty_printer(printer, obj)


More information about the Libreoffice-commits mailing list