+@lldb_command('taskforpmap')
+def TaskForPmap(cmd_args=None):
+ """ Find the task whose pmap corresponds to <pmap>.
+ Syntax: (lldb) taskforpmap <pmap>
+ Multiple -v's can be specified for increased verbosity
+ """
+ if cmd_args == None or len(cmd_args) < 1:
+ raise ArgumentError("Too few arguments to taskforpmap.")
+ pmap = kern.GetValueFromAddress(cmd_args[0], 'pmap_t')
+ print GetTaskSummary.header + " " + GetProcSummary.header
+ for tasklist in [kern.tasks, kern.terminated_tasks]:
+ for t in tasklist:
+ if t.map.pmap == pmap:
+ pval = Cast(t.bsd_info, 'proc *')
+ out_str = GetTaskSummary(t) + " " + GetProcSummary(pval)
+ print out_str
+