<br><br><div class="gmail_quote">On Mon, Sep 24, 2012 at 9:30 PM, Dave Anderson <span dir="ltr"><<a href="mailto:anderson@redhat.com" target="_blank">anderson@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
----- Original Message -----<br>
><br>
> Dave,<br>
><br>
><br>
> On Fri, Sep 21, 2012 at 9:44 PM, Dave Anderson < <a href="mailto:anderson@redhat.com">anderson@redhat.com</a><br>
> > wrote:<br>
><br>
><br>
><br>
><br>
><br>
> ----- Original Message -----<br>
> ><br>
> > Hi Dave,<br>
> ><br>
> ><br>
> > I notice there was some discussion around on enabling<br>
> > the display function parameters feature for crash tool.<br>
> > Like this one:<br>
> > <a href="http://www.redhat.com/archives/crash-utility/2009-May/msg00016.html" target="_blank">http://www.redhat.com/archives/crash-utility/2009-May/msg00016.html</a><br>
><br>
> Yes, it seems to come up every few years. People have tried, but it<br>
> has never come to fruition.<br>
><br>
><br>
> ><br>
> > Although the answer seems to be quite clear, it should be hard to<br>
> > support such feature. But does this feature cannot be done anyway?<br>
> > I think this feature would be great in assisting kernel debug.<br>
> ><br>
> > The main feature I require, first should be know each param's value in the call stack.<br>
> > Then it is better to know each call stack's param's name.<br>
> ><br>
> > Like for do_vfs_ioctl function, it is better to display as:<br>
> > do_vfs_ioctl(filp=xxx, fd=xxx, cmd=xxx, arg=xxx)<br>
> ><br>
> > Do you have any idea on how this could be implemented?<br>
><br>
> No I don't.<br>
><br>
><br>
><br>
> Sorry for asking the stupid question, but I notice that we could<br>
> get the structure member in crash by "struct" command:<br>
><br>
> crash> struct stackframe<br>
> struct stackframe {<br>
> long unsigned int fp;<br>
> long unsigned int sp;<br>
> long unsigned int lr;<br>
> long unsigned int pc;<br>
> }<br>
> SIZE: 16<br>
><br>
><br>
> I check the crash code, and find cmd_struct use gdb interface to<br>
> parse it out.<br>
><br>
><br>
> And the gdb itself seems already could parse out function argument[1], so could<br>
> we still use similar mechanism as the "struct" command to implement a "func"<br>
> command, which could shows the function declaration?<br>
<br>
</div></div>You can either use the "whatis" command to get the function declaration:<br>
<br>
 crash> help whatis<br>
<br>
 NAME<br>
   whatis - search symbol table for data or type information<br>
<br>
 SYNOPSIS<br>
   whatis [struct | union | typedef | symbol]<br>
<br>
 DESCRIPTION<br>
   This command displays the definition of structures, unions, typedefs or<br>
   text/data symbols.<br>
 ...<br>
<br>
<br>
 crash> whatis do_vfs_ioctl<br>
 int do_vfs_ioctl(struct file *, unsigned int, unsigned int, long unsigned int);<br>
 crash><br>
<br>
Or print it with "p", which gives you both the declaration and its virtual address:<br>
<br>
 crash> p do_vfs_ioctl<br>
 do_vfs_ioctl = $14 =<br>
  {int (struct file *, unsigned int, unsigned int, long unsigned int)} 0xffffffff811247ec <do_vfs_ioctl><br>
 crash><br>
<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>That works. :)</div><div>However could it be possible to show the argument without only display its type?</div><div>The kernel is defining the do_vfs_ioctl as:</div>
<div><div>int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,</div><div>             unsigned long arg);</div></div><div>Could the "filp, fd, cmd, arg" be showed out?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">
Dave<br>
<br></div></div></blockquote><div><br></div><div>Thanks,</div><div>Lei</div><div> </div></div>