Re: Kernel Debugging Help
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Thanks Terry & Quinn, (gdb) showprocinfo 0x5006980 Process 0x05006980 name expect pid:00004701 task:0x04f2f1d8 p_stat:2 parent pid:00000001 Cred: euid 501 ruid 501 svuid 501 Flags: 0x00004002 0x00000002 - has a controlling tty !0x00000004 - process is 32 bit 0x00004000 - process has called exec State: Run -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On Aug 7, 2007, at 2:25 AM, Arvind Dalvi wrote: I will read the GDB documentation in more depth, and will try a few stint...... In the meantime, Quinn, if you could expand the showtask macro to also include the status field (p->stat) of the BSD proc structure, it would be great.... We won't be taking such a change back into kgmacros for the simple reason that not all Mach tasks have associated BSD processes. You could try using the following on proc structure address; not sure how applicable it is, or if things have changed too much, though... it has output vaguely like: ====================== define showprocinfo set $kgm_spi_proc = (proc_t)$arg0 printf "Process 0x%08x\n", $kgm_spi_proc printf " name %s\n", $kgm_spi_proc->p_comm printf " pid:%.8d", $kgm_spi_proc->p_pid printf " task:0x%.8x", $kgm_spi_proc->task printf " p_stat:%.1d", $kgm_spi_proc->p_stat printf " parent pid:%.8d\n", $kgm_spi_proc->p_ppid # decode part of credential set $kgm_spi_cred = $kgm_spi_proc->p_ucred if ($kgm_spi_cred != 0) printf "Cred: euid %d ruid %d svuid %d\n", $kgm_spi_cred-
cr_uid, $kgm_spi_cred->cr_ruid, $kgm_spi_cred->cr_svuid
else printf "Cred: (null)\n" end # decode flags set $kgm_spi_flag = $kgm_spi_proc->p_flag printf "Flags: 0x%08x\n", $kgm_spi_flag if ($kgm_spi_flag & 0x00000001) printf " 0x00000001 - may hold advisory locks\n" end if ($kgm_spi_flag & 0x00000002) printf " 0x00000002 - has a controlling tty\n" end if ($kgm_spi_flag & 0x00000004) printf " 0x00000004 - process is 64 bit\n" else printf " !0x00000004 - process is 32 bit\n" end if ($kgm_spi_flag & 0x00000008) printf " 0x00000008 - no SIGCHLD on child stop\n" end if ($kgm_spi_flag & 0x00000010) printf " 0x00000010 - waiting for child exec/exit\n" end if ($kgm_spi_flag & 0x00000020) printf " 0x00000020 - has started profiling\n" end if ($kgm_spi_flag & 0x00000040) printf " 0x00000040 - in select; wakeup/waiting danger\n" end if ($kgm_spi_flag & 0x00000080) printf " 0x00000080 - was stopped and continued\n" end if ($kgm_spi_flag & 0x00000100) printf " 0x00000100 - has set privileges since exec\n" end if ($kgm_spi_flag & 0x00000200) printf " 0x00000200 - system process: no signals, stats, or swap\n" end if ($kgm_spi_flag & 0x00000400) printf " 0x00000400 - timing out during a sleep\n" end if ($kgm_spi_flag & 0x00000800) printf " 0x00000800 - debugged process being traced\n" end if ($kgm_spi_flag & 0x00001000) printf " 0x00001000 - debugging process has waited for child\n" end if ($kgm_spi_flag & 0x00002000) printf " 0x00002000 - exit in progress\n" end if ($kgm_spi_flag & 0x00004000) printf " 0x00004000 - process has called exec\n" end if ($kgm_spi_flag & 0x00008000) printf " 0x00008000 - owe process an addupc() XXX\n" end if ($kgm_spi_flag & 0x00010000) printf " 0x00010000 - affinity for Rosetta children\n" end if ($kgm_spi_flag & 0x00020000) printf " 0x00020000 - wants to run Rosetta\n" end if ($kgm_spi_flag & 0x00040000) printf " 0x00040000 - has wait() in progress\n" end if ($kgm_spi_flag & 0x00080000) printf " 0x00080000 - kdebug tracing on for this process\n" end if ($kgm_spi_flag & 0x00100000) printf " 0x00100000 - blocked due to SIGTTOU or SIGTTIN\n" end if ($kgm_spi_flag & 0x00200000) printf " 0x00200000 - has called reboot()\n" end if ($kgm_spi_flag & 0x00400000) printf " 0x00400000 - is TBE state\n" end if ($kgm_spi_flag & 0x00800000) printf " 0x00800000 - signal exceptions\n" end if ($kgm_spi_flag & 0x01000000) printf " 0x01000000 - being branch traced\n" end if ($kgm_spi_flag & 0x02000000) printf " 0x02000000 - has vfork() children\n" end if ($kgm_spi_flag & 0x04000000) printf " 0x04000000 - not allowed to attach\n" end if ($kgm_spi_flag & 0x08000000) printf " 0x08000000 - vfork() in progress\n" end if ($kgm_spi_flag & 0x10000000) printf " 0x10000000 - no shared libraries\n" end if ($kgm_spi_flag & 0x20000000) printf " 0x20000000 - force quota for root\n" end if ($kgm_spi_flag & 0x40000000) printf " 0x40000000 - no zombies when children exit\n" end if ($kgm_spi_flag & 0x80000000) printf " 0x80000000 - don't hang on remote FS ops\n" end # decode state set $kgm_spi_state = $kgm_spi_proc->p_stat printf "State: " if ($kgm_spi_state == 1) printf "Idle\n" end if ($kgm_spi_state == 2) printf "Run\n" end if ($kgm_spi_state == 3) printf "Sleep\n" end if ($kgm_spi_state == 4) printf "Stop\n" end if ($kgm_spi_state == 5) printf "Zombie\n" end if ($kgm_spi_state == 6) printf "Reaping\n" end if ($kgm_spi_state < 1 || $kgm_spi_state > 6) printf "(Unknown)\n" end end ====================== This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert