[Crash-utility] [PATCH 1/1] Resend CLI list command, print deep structure members

Dave Anderson anderson at redhat.com
Fri May 15 16:15:50 UTC 2015



----- Original Message -----
> 
> Hi Dave,
> 
> please take a look at updated patch.
> 
> Thanks,
> Alexandr
> 

I did some initial testing, starting with the "task" command, but then
ran into problems.

First, I fixed/simplified task_struct_member() so that the requested
members would be printed in the same order that was specified
in the comma-separated list.  I removed your shortarglist/longarglist
stuff and just moved the parsing calls into the upper loop, and moved
the header display determination from parse_task_thread() back 
into do_task().  Although parse_task_thread() will now receive
only one member at a time, it still takes an array of members just
in case it's needed in the future.  I've attached my modified version
of task.c for you to use.

But the patch still has problems, specifically with the "struct"
command and embedded arrays, which don't work at all.  I noticed it
by testing array member displays with the "task" command, taking 
this example:

crash> task_struct.pids
struct task_struct {
   [608] struct pid_link pids[3];
}
crash>

Here they are:

crash> task -R pids
PID: 26602  TASK: ffff8801f0ac9e40  CPU: 1   COMMAND: "crash"
  pids = {{
      node = {
        next = 0x0, 
        pprev = 0xffff880100a6a488
      }, 
      pid = 0xffff880100a6a480
    }, {
      node = {
        next = 0xffff8801f0aca848, 
        pprev = 0xffff880209d064c8
      }, 
      pid = 0xffff880100a6a100
    }, {
      node = {
        next = 0xffff8801f0aca860, 
        pprev = 0xffff880209d064e0
      }, 
      pid = 0xffff88010d07ed00
    }}, 

crash> 

With your patch applied, I selected the first element in the array,
which works OK:

crash> task -R pids[0]
PID: 26602  TASK: ffff8801f0ac9e40  CPU: 3   COMMAND: "crash"
  pids[0] =   {
    node = {
      next = 0x0,
      pprev = 0xffff880100a6a488
    },
    pid = 0xffff880100a6a480
  },

But testing the same thing with the "struct" command shows this:

crash> struct task_struct.pids ffff8801f0ac9e40
  pids = {{
      node = {
        next = 0x0, 
        pprev = 0xffff880100a6a488
      }, 
      pid = 0xffff880100a6a480
    }, {
      node = {
        next = 0xffff8801f0aca848, 
        pprev = 0xffff8801f0acafd8
      }, 
      pid = 0xffff880100a6a100
    }, {
      node = {
        next = 0xffff8801f0aca860, 
        pprev = 0xffff8801f0acaff0
      }, 
      pid = 0xffff88010d07ed00
    }}, 
crash> struct task_struct.pids[0] ffff8801f0ac9e40
crash> 

It always seems to come up empty with array elements.

For another example, I can print the whole array from a structure,
but selecting an array member returns nothing:

crash> mm_struct.saved_auxv
struct mm_struct {
  [320] unsigned long saved_auxv[44];
}
crash>

crash> mm_struct.saved_auxv ffff88001552d400
  saved_auxv = {33, 140734416019456, 16, 3219913727, 6, 4096, 17, 100, 3, 4194368, 4, 56, 5, 8, 7, 0, 8, 0, 9, 4597288, 11, 0, 12, 0, 13, 0, 14, 0, 23, 0, 25, 140734415656601, 31, 140734415658992, 15, 140734415656617, 0, 0, 0, 0, 0, 0, 0, 0}
crash> mm_struct.saved_auxv[0] ffff88001552d400
crash> 

Thanks,
  Dave


-------------- next part --------------
A non-text attachment was scrubbed...
Name: task.c
Type: text/x-c++src
Size: 263898 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20150515/89cf2761/attachment.bin>


More information about the Crash-utility mailing list