[Crash-utility] getting values of local variable

Dave Anderson anderson at redhat.com
Thu Dec 5 16:25:24 UTC 2013



----- Original Message -----
> How can i get the value of a structure variable used in a kernel module.The
> structure is private to the module. Using struct command did not yield any
> result as the structure type is unknown to crash. Thanks.
> 
> --
> Vivek Anand T Kallampally
> 

Have you loaded the debuginfo data of the kernel module into the crash session?

For example, in the "fs/nfs/mount_clnt.c" kernel module there is this declaration:

 static struct rpc_stat mnt_stats;

Without loading the debuginfo data of the "nfs" module, there is only minimal 
information available about the data structure instance, namely just its virtual
address, its section, and the module that it's contained within:

  crash> sym mnt_stats
  ffffffffa086bca0 (b) mnt_stats [nfs]
  crash> p mnt_stats
  p: gdb request failed: p mnt_stats
  crash> whatis mnt_stats
  whatis: gdb request failed: whatis mnt_stats
  crash>

Loading the debuginfo data of the module (usually) brings in the additional 
information into the crash session:

  crash> mod -s nfs
       MODULE       NAME                     SIZE  OBJECT FILE
  ffffffffa086b920  nfs                    169344  /lib/modules/3.9.10-100.fc17.x86_64/kernel/fs/nfs/nfs.ko 
  crash> whatis mnt_stats
  struct rpc_stat mnt_stats;
  crash> p mnt_stats
  mnt_stats = $2 = {
    program = 0x0, 
    netcnt = 0, 
    netudpcnt = 0, 
    nettcpcnt = 0, 
    nettcpconn = 0, 
    netreconn = 3, 
    rpccnt = 6, 
    rpcretrans = 0, 
    rpcauthrefresh = 6, 
    rpcgarbage = 0
  }
  crash> 
  
Dave




More information about the Crash-utility mailing list