Re: Kernel Debugging Help
Re: Kernel Debugging Help
- Subject: Re: Kernel Debugging Help
- From: Quinn <email@hidden>
- Date: Tue, 7 Aug 2007 11:07:21 +0100
At 10:25 +0100 7/8/07, Arvind Dalvi wrote:
I will read the GDB documentation in more depth, and will try a few
stint......
Cool. For those of us that live and breath this stuff, it's tricky
to remember how hard it is to get started.
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....
The following is the diffs from a standard kgmacros file (in my case
taken from the 10.4.9 Intel KDK).
$ diff -u /Volumes/KernelDebugKit/kgmacros kgmacros
--- /Volumes/KernelDebugKit/kgmacros 2006-06-21 04:59:49.000000000 +0100
+++ kgmacros 2007-08-07 10:58:03.000000000 +0100
@@ -1015,13 +1015,35 @@
define showprocheader
- printf " pid proc command\n"
+ printf " pid stat proc command\n"
end
define showprocint
set $kgm_procp = (struct proc *)$arg0
if $kgm_procp != 0
printf "] ", $kgm_procp->p_pid
+ set $kgm_proc_stat = $kgm_procp->p_stat
+ if $kgm_proc_stat == 1
+ printf " I "
+ else
+ if $kgm_proc_stat == 2
+ printf " R "
+ else
+ if $kgm_proc_stat == 3
+ printf " S "
+ else
+ if $kgm_proc_stat == 4
+ printf " T "
+ else
+ if $kgm_proc_stat == 5
+ printf " Z "
+ else
+ printf "M ", $kgm_proc_stat
+ end
+ end
+ end
+ end
+ end
printf "0xx ", $kgm_procp
printf "%s\n", $kgm_procp->p_comm
else
The basic idea is pretty simple:
o I modified showprocheader to print an extra header column.
o I modified showprocint (which is called by showalltasks, and
others) to print the contents of that column. The only tricky part
is converting the state value to a character; GDB's scripting
language doesn't have a switch statement or any "else if" construct.
I am too sure whether reporting status of a process would be the
right thing, as it are threads that have state
(waiting/suspended/ready/running) rather than the process.
The process state /is/ meaningful (for example, if you stop a process
using ^Z, you'll get a state value of SSTOP (4) which is printed as
"T") but, as you surmised, it's not the only part of the picture.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden