[nSLUG] kernel debugging?

Peter Cordes peter at llama.nslug.ns.ca
Thu Oct 23 23:44:47 ADT 2003

On Thu, Oct 23, 2003 at 09:53:30PM -0300, Jeff Warnica wrote:
> It might be blazingly obvious, but try:
> $ dir /proc/$$

 Yeah, but what kernel data structures does that correspond to?  I'm running
gdb on the kernel here, and I want to see the state of the variables used by
the code in fs/pipe.c, esp. the pipe inode data structure.

peter at genome3:~$ ll /proc/915/fd
total 3
lr-x------    1 peter    peter          64 Oct 23 22:03 0 -> pipe:[18859]
l-wx------    1 peter    peter          64 Oct 23 22:03 1 -> /tmp/foo
lrwx------    1 peter    peter          64 Oct 23 22:03 2 -> /dev/pts/1 (deleted)

 Is there a way to find the task_struct for a process other than searching
by hand with gdb through the circularly linked list of them, starting with
init_tasks[0]?  Is 18859 the inode of the pipe?  Then what do I do with that
(in gdb).  There's a pipe filesystem, pipefs, listed in /proc/filesystems,
but how do I get from the inode number to a struct inode in kernel memory?

> On Thu, 2003-10-23 at 21:17, Peter Cordes wrote:
> >  As I asked in my other email, what kernel data structures are useful for
> > finding stuff about a process given a PID?  How about finding out about a
> > file descriptor that refers to a pipe?  I guess I'd better check out the
> > kernel hacking HOWTO and so on.

#define X(x,y) x##y
Peter Cordes ;  e-mail: X(peter at cor , des.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BC

More information about the nSLUG mailing list