diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-06-29 01:42:50 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-06-29 22:42:42 +0200 |
commit | a40334ef4deb03c207b7f959a0a9c93ef3e5c459 (patch) | |
tree | 1a201aad6997e02b7414bfe44f52cf0d77b008d8 /solenv | |
parent | ff641dc9e4d2aff1d1cbe4425cd9c03a2edc847e (diff) |
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@fbihome.de>
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gdb/libreoffice/vcl.py | 31 |
1 files changed, 27 insertions, 4 deletions
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) |