X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/ea3f04195ba4a5034c9c8e9b726d4f7ce96f1832..2a1bd2d3eef5c7a7bb14f4bb9fdbca9a96ee4752:/tools/lldbmacros/core/kernelcore.py diff --git a/tools/lldbmacros/core/kernelcore.py b/tools/lldbmacros/core/kernelcore.py index 01067a75d..d21b5c912 100755 --- a/tools/lldbmacros/core/kernelcore.py +++ b/tools/lldbmacros/core/kernelcore.py @@ -247,7 +247,7 @@ def IterateRBTreeEntry(element, element_type, field_name): elt = cast(elt, element_type) -def IteratePriorityQueue(root, element_type, field_name): +def IterateSchedPriorityQueue(root, element_type, field_name): """ iterate over a priority queue as defined with struct priority_queue from osfmk/kern/priority_queue.h root - value : Value object for the priority queue element_type - str : Type of the link element @@ -257,9 +257,9 @@ def IteratePriorityQueue(root, element_type, field_name): value : an object thats of type (element_type). Always a pointer object """ def _make_pqe(addr): - return value(root.GetSBValue().CreateValueFromExpression(None,'(struct priority_queue_entry *)'+str(addr))) + return value(root.GetSBValue().CreateValueFromExpression(None,'(struct priority_queue_entry_sched *)'+str(addr))) - queue = [unsigned(root.pq_root_packed) & ~3] + queue = [unsigned(root.pq_root)] while len(queue): elt = _make_pqe(queue.pop()) @@ -270,6 +270,20 @@ def IteratePriorityQueue(root, element_type, field_name): if addr: queue.append(addr) elt = elt.next +def SchedPriorityStableQueueRootPri(root, element_type, field_name): + """ Return the root level priority of a priority queue as defined with struct priority_queue from osfmk/kern/priority_queue.h + root - value : Value object for the priority queue + element_type - str : Type of the link element + field_name - str : Name of the field in link element's structure + returns: + The sched pri of the root element. + """ + def _make_pqe(addr): + return value(root.GetSBValue().CreateValueFromExpression(None,'(struct priority_queue_entry_stable *)'+str(addr))) + + elt = _make_pqe(unsigned(root.pq_root)) + return (elt.key >> 8); + def IterateMPSCQueue(root, element_type, field_name): """ iterate over an MPSC queue as defined with struct mpsc_queue_head from osfmk/kern/mpsc_queue.h root - value : Value object for the mpsc queue