+@lldb_type_summary(['tty_dev_t', 'tty_dev_t *'])
+@header("{0: <20s} {1: <10s} {2: <10s} {3: <15s} {4: <15s} {5: <15s} {6: <15s}".format("tty_dev","master", "slave", "open", "free", "name", "revoke"))
+def GetTTYDevSummary(tty_dev):
+ """ Summarizes the important fields in tty_dev_t structure.
+ params: tty_dev: value - value object representing a tty_dev_t in kernel
+ returns: str - summary of the tty_dev
+ """
+ out_string = ""
+ format_string = "{0: <#020x} {1: <#010x} {2: <#010x} {3: <15s} {4: <15s} {5: <15s} {6: <15s}"
+ open_fn = kern.Symbolicate(int(hex(tty_dev.open), 16))
+ free_fn = kern.Symbolicate(int(hex(tty_dev.free), 16))
+ name_fn = kern.Symbolicate(int(hex(tty_dev.name), 16))
+ revoke_fn = kern.Symbolicate(int(hex(tty_dev.revoke), 16))
+ out_string += format_string.format(tty_dev, tty_dev.master, tty_dev.slave, open_fn, free_fn, name_fn, revoke_fn)
+ return out_string
+
+@lldb_type_summary(['kqueue *'])
+@header("{: <20s} {: <20s} {: <6s} {: <20s} {: <10s}".format('kqueue', 'process', '#events', 'wqs', 'state'))
+def GetKQueueSummary(kq):
+ """ summarizes kqueue information
+ returns: str - summary of kqueue
+ """
+ out_string = ""
+ format_string = "{o: <#020x} {o.kq_p: <#020x} {o.kq_count: <6d} {o.kq_wqs: <#020x} {st_str: <10s}"
+ state = int(kq.kq_state)
+ state_str = ''
+ mask = 0x1
+ while mask <= 0x80 :
+ if int(state & mask):
+ state_str += ' ' + xnudefines.kq_state_strings[int(state & mask)]
+ mask = mask << 1
+ out_string += format_string.format(o=kq, st_str=state_str)
+ return out_string
+
+@lldb_type_summary(['knote *'])
+@header("{0: <20s}".format('knote'))
+def GetKnoteSummary(kn):
+ """ Summarizes a knote and related information
+ returns: str - summary of knote
+ """
+ out_string = ""
+ format_string = "{o: <#020x}"
+ out_string += format_string.format(o=kn)
+ return out_string
+