]>
git.saurik.com Git - apple/xnu.git/blob - tools/lldbmacros/ulock.py
2 from scheduler
import GetRecentTimestamp
8 3: "UNFAIR_LOCK64_SHARED",
9 4: "COMPARE_AND_WAIT64",
10 5: "COMPARE_AND_WAIT64_SHARED"
13 @header("{:<20s} {:<20s} {:<20s} {:<10s} {:<20s} {:<20s} {:<20s}".format(
14 'ull_t', 'kind', 'addr/obj', 'pid/offs', 'owner', 'turnstile', 'waiters'))
15 def GetUlockSummary(ull
):
16 code
= int(ull
.ull_opcode
)
17 if ulock_types
.has_key(code
):
18 ull_type
= ulock_types
[code
]
20 ull_type
= "{:#x}".format(code
)
22 s
= "{ull: <#20x} {ull_type: <20s}".format(ull
=ull
, ull_type
=ull_type
)
24 if int(ulk
.ulk_key_type
) is 1:
25 s
+= " {ulk.ulk_addr: <#20x} {ulk.ulk_pid: <10d}".format(ulk
=ulk
)
26 elif int(ulk
.ulk_key_type
) is 2:
27 s
+= " {ulk.ulk_object: <#20x} {ulk.ulk_offset: <10d}".format(ulk
=ulk
)
29 s
+= " {:<20s} {:<10s}".format("", "")
31 return s
+ " {ull.ull_owner: <#20x} {ull.ull_turnstile: <#20x} {ull.ull_nwaiters: >7d}".format(ull
=ull
)
33 @lldb_command('showallulocks', fancy
=True)
34 def ShowAllUlocks(cmd_args
=None, cmd_options
={}, O
=None):
35 """ Display a summary of all the ulocks in the system
40 with O
.table(GetUlockSummary
.header
):
41 count
= kern
.globals.ull_hash_buckets
;
42 buckets
= kern
.globals.ull_bucket
43 for i
in xrange(0, count
):
44 for ull
in IterateLinkageChain(addressof(buckets
[i
].ulb_head
), 'ull_t *', 'ull_hash_link'):
45 print GetUlockSummary(ull
)