total = total + 1
if (show_tr != 0):
- trn = (mca.mca_next_trn + idx - 1) % unsigned(kern.globals.mca_trn_max)
+ if (mca.mca_next_trn == 0):
+ trn = 1
+ else:
+ trn = 0
out_string += "Transaction " + str(int(trn)) + " at " + str(int(mca.mca_trns[int(trn)].mca_tstamp)) + " by thread: 0x" + str(hex(mca.mca_trns[int(trn)].mca_thread)) + ":\n"
cnt = 0
while (cnt < mca.mca_trns[int(trn)].mca_depth):
pointer_format_string = "0x{0:<8x} "
return pointer_format_string.format(kgm_pc)
-def GetKmodAddrIntAsString(kgm_pc):
- global kgm_pkmod
- global kgm_pkmodst
- global kgm_pkmoden
-
- out_string = ""
- mh_execute_addr = int(lldb_run_command('p/x (uintptr_t *)&_mh_execute_header').split('=')[-1].strip(), 16)
-
- out_string += GetPointerAsString(kgm_pc)
- if ((unsigned(kgm_pc) >= unsigned(kgm_pkmodst)) and (unsigned(kgm_pc) < unsigned(kgm_pkmoden))):
- kgm_off = kgm_pc - kgm_pkmodst
- out_string += "<" + str(Cast(kgm_pkmod, 'kmod_info_t *').name) + " + 0x" + str(kgm_off) + ">"
- else:
- kgm_kmodp = kern.globals.kmod
- if ((kern.arch == 'x86_64') and (long(kgm_pc) >= long(mh_execute_addr))):
- kgm_kmodp = 0
-
- while kgm_kmodp:
- kgm_off = unsigned((kgm_pc - kgm_kmodp.address) & 0x00000000ffffffff)
- if ((long(kgm_kmodp.address) <= long(kgm_pc)) and (kgm_off) < unsigned(kgm_kmodp.size)):
- kgm_pkmod = kgm_kmodp
- kgm_pkmodst = unsigned(kgm_kmodp.address)
- kgm_pkmoden = unsigned(kgm_pkmodst + kgm_kmodp.size)
- kgm_kmodp = 0
- else:
- kgm_kmodp = kgm_kmodp.next
- return out_string
-
def GetPc(kgm_pc):
- out_string = ""
- mh_execute_addr = int(lldb_run_command('p/x (uintptr_t *)&_mh_execute_header').split('=')[-1].strip(), 16)
- if (unsigned(kgm_pc) < unsigned(mh_execute_addr) or unsigned(kgm_pc) >= unsigned(kern.globals.vm_kernel_top)):
- out_string += GetKmodAddrIntAsString(kgm_pc)
- else:
- out_string += GetSourceInformationForAddress(int(kgm_pc))
- return out_string + "\n"
+ out_string = GetSourceInformationForAddress(unsigned(kgm_pc)) + "\n"
+ return out_string
# Macro: mbuf_showactive
def MbufShowAll(cmd_args=None):
""" Print all mbuf objects
"""
- print GetMbufWalkAllSlabs(1, 1, 0)
+ print GetMbufWalkAllSlabs(1, 1, 1)
# EndMacro: mbuf_showall
# Macro: mbuf_countchain
cnt += 1
return out_string
+@lldb_command('mbuf_largefailures')
+def MbufLargeFailures(cmd_args=None):
+ """ Print the largest allocation failures
+ """
+ topcnt = 0
+ if (int(len(cmd_args)) > 0 and int(cmd_args[0]) < 5):
+ maxcnt = cmd_args[0]
+ else:
+ maxcnt = 5
+ while (topcnt < maxcnt):
+ trace = kern.globals.mtracelarge_table[topcnt]
+ if (trace.size == 0):
+ topcnt += 1
+ continue
+ print str(trace.size)
+ if (trace.depth != 0):
+ cnt = 0
+ while (cnt < trace.depth):
+ print str(cnt + 1) + ": " + GetPc(trace.addr[cnt])
+ cnt += 1
+ topcnt += 1
+
# Macro: mbuf_traceleak
@lldb_command('mbuf_traceleak')
out_string += "Total # of objects cached:\t\t" + str(total) + "\n"
print out_string
# EndMacro: mcache_showcache
+
+# Macro: mbuf_wdlog
+@lldb_command('mbuf_wdlog')
+def McacheShowCache(cmd_args=None):
+ """Display the watchdog log
+ """
+ lldb_run_command('settings set max-string-summary-length 4096')
+ print('%s' % lldb_run_command('p/s mbwdog_logging').replace("\\n","\n"))
+# EndMacro: mbuf_wdlog