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

Dave Anderson anderson at redhat.com
Thu May 14 20:02:10 UTC 2015



----- Original Message -----
> 
> Hi Dave,
> 
> thank you for the comments. Here is the fixed patch.
> 
> Best,
> Alexandr


Hi Alexandr,

I actually haven't studied the meat of parse_for_member_new() yet,
but in testing the patch, I've come up with a few issues that still
need addressing.

Unlike what you have done for "struct" and "list", when the "task"
command calls task_struct_member(), if *any* of the comma-separated
members are the new complicated format, you set the call_new_parser
flag, so it somewhat defeats the purpose of having the flag at all:

        if (call_new_parser) {
                for (i = 0; i < argcnt; i++) {
                        dm.member = arglist[i];
                        parse_for_member_new(&dm, 0);
                }
        } else {
                parse_task_thread(argcnt, arglist, tc);
        }

I still would like the confidence of knowing that the old function 
will still be used with the simple "struct.member" format.

And related to the issue above, here's a bug -- the "task" command
is quite often useful to call from "foreach", where for each task, 
the task's banner is displayed followed by the requested data.
For example:

  crash> foreach task -R prio,sched_class
  PID: 0      TASK: ffffffff81c13440  CPU: 0   COMMAND: "swapper/0"
    prio = 0x78, 
    sched_class = 0xffffffff81808960 <idle_sched_class>, 
  
  PID: 0      TASK: ffff88021282d330  CPU: 1   COMMAND: "swapper/1"
    prio = 0x78, 
    sched_class = 0xffffffff81808960 <idle_sched_class>, 
  
  PID: 0      TASK: ffff88021282dac0  CPU: 2   COMMAND: "swapper/2"
    prio = 0x78, 
    sched_class = 0xffffffff81808960 <idle_sched_class>, 
  
  PID: 0      TASK: ffff88021282e250  CPU: 3   COMMAND: "swapper/3"
    prio = 0x78, 
    sched_class = 0xffffffff81808960 <idle_sched_class>, 
  
  PID: 1      TASK: ffff880212828000  CPU: 2   COMMAND: "systemd"
    prio = 0x78, 
    sched_class = 0xffffffff81808a40 <fair_sched_class>, 
  
  PID: 2      TASK: ffff880212828790  CPU: 3   COMMAND: "kthreadd"
    prio = 0x78, 
    sched_class = 0xffffffff81808a40 <fair_sched_class>, 
  
  PID: 3      TASK: ffff880212828f20  CPU: 0   COMMAND: "ksoftirqd/0"
    prio = 0x78, 
    sched_class = 0xffffffff81808a40 <fair_sched_class>, 
  
  PID: 5      TASK: ffff880212829e40  CPU: 0   COMMAND: "kworker/0:0H"
    prio = 0x64, 
    sched_class = 0xffffffff81808a40 <fair_sched_class>, 
  
  PID: 7      TASK: ffff88021282ad60  CPU: 0   COMMAND: "kworker/u:0H"
    prio = 0x64, 
    sched_class = 0xffffffff81808a40 <fair_sched_class>, 
  
  PID: 8      TASK: ffff88021282b4f0  CPU: 0   COMMAND: "migration/0"
    prio = 0x0, 
    sched_class = 0xffffffff81808d20 <stop_sched_class>,
  
  ...

But when I add a new extended reference, the banner doesn't get displayed,
rendering the command useless:

  crash> foreach task -R prio,sched_class,se.on_rq
  prio = 0x78,
  sched_class = 0xffffffff81808960 <idle_sched_class>,
  se.on_rq = 0x0,

  prio = 0x78,
  sched_class = 0xffffffff81808960 <idle_sched_class>,
  se.on_rq = 0x0,

  prio = 0x78,
  sched_class = 0xffffffff81808960 <idle_sched_class>,
  se.on_rq = 0x0,

  prio = 0x78,
  sched_class = 0xffffffff81808960 <idle_sched_class>,
  se.on_rq = 0x0,

  prio = 0x78,
  sched_class = 0xffffffff81808a40 <fair_sched_class>,
  se.on_rq = 0x0,

  prio = 0x78,
  sched_class = 0xffffffff81808a40 <fair_sched_class>,
  se.on_rq = 0x0,

  prio = 0x78,
  sched_class = 0xffffffff81808a40 <fair_sched_class>,
  se.on_rq = 0x0,

  prio = 0x64,
  sched_class = 0xffffffff81808a40 <fair_sched_class>,
  se.on_rq = 0x0,

  prio = 0x64,
  sched_class = 0xffffffff81808a40 <fair_sched_class>,
  se.on_rq = 0x0,

  prio = 0x0,
  sched_class = 0xffffffff81808d20 <stop_sched_class>,
  se.on_rq = 0x0,

  ...


Also, similar to the "list" command, the "tree" command also supports the
"-s struct.member" option:

  crash> help tree
  ... [ cut ] ...

    -s struct  For each entry in a tree, format and print it as this type of data
               structure; use the "struct.member" format in order to display a
               particular member of the structure.  To display multiple members
               of a structure, use a comma-separated list of members.

Can you look into putting support there as well?

I'm also going to need "help" page updates for the commands that use "struct.member"
arguments.  I would do it, but if you want to get a head-start, please feel free
to do so.

Thanks,
  Dave
 




More information about the Crash-utility mailing list