Thursday, August 17, 2006

IBM AIX 5.3 - Debugging running or hung process
(User Space Debugging & Kernel Threads)


Once you have a crash dump, there are several things you might like to do. If you are fiddling with filesystems, for example, you would like to be able to print vnodes and gnodes.

In kdb, you first need to tell kdb the header that defines your structure. In case of struct vnode, its sys/vnode.h. So we invoke kdb as


# kdb -i /usr/include/sys/vnode.h

and issue the print command


0>print vnode address


Which should print something like

struct vnode {
ushort v_flag = 0x0000;
ushort v_flag2 = 0x0000;
ulong32int64_t v_count = 0x00000000;
int v_vfsgen = 0x00000000;
union Simple_lock {
simple_lock_data _slock = 0x00000000;
struct lock_data_instrumented *_slockp = 0x00000000;
} v_lock;
struct vfs *v_vfsp = 0x31349808;
struct vfs *v_mvfsp = 0x00000000;
struct gnode *v_gnode = 0x13C823E0;
struct vnode *v_next = 0x00000000;
struct vnode *v_vfsnext = 0x13987F38;
struct vnode *v_vfsprev = 0x13D1AAE8;
union v_data {
void *_v_socket = 0x00000000;
struct vnode *_v_pfsvnode = 0x00000000;
} _v_data;
char *v_audit = 0x00000000;
} foo[0];

No comments: