]>
git.saurik.com Git - apple/xnu.git/blob - tools/lldbmacros/pgtrace.py
2 # -*- coding: utf-8 -*-
7 @lldb_command('showpgtrace')
8 def ShowPgtrace(cmd_args
=None, cmd_options
={}):
9 """ Display pgtrace buffer contents
13 max_entry
= kern
.globals.pgtrace
.size
14 rd_idx
= kern
.globals.pgtrace
.rdidx
15 wr_idx
= kern
.globals.pgtrace
.wridx
18 print "rd_idx=%d wr_idx=%d num_entries=%d max_entry=%d" % (rd_idx
, wr_idx
, wr_idx
-rd_idx
, max_entry
)
21 rw_str
= { GetEnumValue('pgtrace_rw_t::PGTRACE_RW_LOAD'): "R",
22 GetEnumValue('pgtrace_rw_t::PGTRACE_RW_STORE'): "W",
23 GetEnumValue('pgtrace_rw_t::PGTRACE_RW_PREFETCH'): "P" }
25 while rd_idx
!= wr_idx
:
26 clipped_idx
= rd_idx
% max_entry
27 entry
= kern
.globals.pgtrace
.logs
+ sizeof('log_t') * clipped_idx
28 entry
= kern
.GetValueFromAddress(entry
, 'log_t *')
30 entry_str
= "[%d] id=%lu time=%lu %s " % (clipped_idx
, entry
.id, entry
.res
.rr_time
, rw_str
[int(entry
.res
.rr_rw
)])
32 for i
in range(entry
.res
.rr_num
):
33 entry_str
+= "%x=%x " % (entry
.res
.rr_addrdata
[i
].ad_addr
, entry
.res
.rr_addrdata
[i
].ad_data
)