<div dir="ltr"><p style="font-family:inherit;font-style:inherit;font-variant-caps:inherit;color:rgb(36,39,41);font-size:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;clear:both">Hello All,</p><span class="gmail-im" style="font-size:12.800000190734863px"><p style="font-size:inherit;font-style:inherit;font-variant-caps:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-stretch:inherit;line-height:inherit;vertical-align:baseline;clear:both"><font face="inherit">I'm currently debugging my </font><span style="font-family:inherit;font-style:inherit;font-variant-caps:inherit;font-size:inherit">xnu based kernel module and I'm using the A</span><font face="arial, helvetica, sans-serif"><span style="font-style:inherit;font-variant-caps:inherit;font-size:inherit">PI of</span><span style="font-style:inherit;font-variant-caps:inherit;font-size:inherit"> </span><span style="font-style:inherit;font-variant-caps:inherit;color:rgb(0,0,0)">kernel.py from the KDK.</span></font></p><p style="font-family:inherit;font-size:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;clear:both">I need some advice about how to print the backtraces of all kernel space threads or all kernel space threads per task.</p><p style="font-size:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;clear:both"><span style="font-family:inherit;font-size:inherit;font-style:inherit;font-variant-caps:inherit">Here's what I've done so far : </span><br></p><p style="font-family:inherit;font-size:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;clear:both"><span style="font-family:inherit;font-size:inherit;font-style:inherit;font-variant-caps:inherit">1. getting kernel_task id</span></p><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(169,169,169)">(lldb) </span><span style="font-variant-ligatures:no-common-ligatures">showalltasks </span></p><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">task                 vm_map               ipc_space            #acts flags    pid       process             io_policy  wq_state  command             </span></p><p style="font-family:inherit;font-size:inherit;margin:0px 0px 1em;padding:0px;border:0px;font-style:inherit;font-variant-caps:inherit;font-stretch:inherit;line-height:inherit;vertical-align:baseline;clear:both">

</p><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">0xffffff800d828550   0xffffff800a1038d8   0xffffff800d5d17c0     140            0   0xffffff8007abb460                -1 -1 -1    kernel_task         </span></p><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures">2. dump all threads which belongs to kernel_task</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(169,169,169)">(lldb) </span><span style="font-variant-ligatures:no-common-ligatures">showtaskthreads 0xffffff800d828550</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">task                 vm_map               ipc_space            #acts flags    pid       process             io_policy  wq_state  command             </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">0xffffff800d828550   0xffffff800a1038d8   0xffffff800d5d17c0     140            0   0xffffff8007abb460                -1 -1 -1    kernel_task         </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>thread                   thread_id  processor            base   pri    sched_mode      io_policy       state    ast          waitq                            wait_event           wmesg                thread_name         </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0xffffff8007acf098       0x65       0xffffff8007a8a7b8   92     92     fixed bound                     WU       L            0xffffff804119e550               0xffffff8007a87a30 <vm_page_free_wanted>                                          </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0xffffff800d83f4c0       0x66       0xffffff8007a8a7b8   0      0      fixed bound                     RI       L                                                                                                           </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0xffffff800d83f958       0x67       0xffffff8041ad6000   95     95     fixed                           WU       L            0xffffff804119c240               0xffffff8007303840 <sched_timeshare_maintenance_continue>                      sched_maintenance_thread</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0xffffff800d83fdf0       0x68       0xffffff8041ad6000   80     80     fixed                           WU       L            0xffffff804119e850               0xffffff8007acf9f0                                            </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0xffffff800d83f028       0x69       0xffffff8007a8a7b8   93     93     fixed                           WU                    0xffffff804119e5e0               0xffffff8007acfa08                                            </span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>0xffffff800d83eb90       0x6a       0xffffff8041ad6000   80     80     fixed                           WU                    0xffffff80411a07a0               0xffffff8007acf9c8                                            </span></p><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures">Now I've got record for each thread in the kernel_task along with info such as thread id, but not the backtrace ... </span></div><div>is there any command in the KDK which can retrieve the backtrace for all the threads per task or any single thread ? </div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div>Thanks , </div><div>Zohar </div></span></div></span></div>