Dave,

On Fri, Sep 21, 2012 at 9:44 PM, Dave Anderson <anderson@redhat.com> wrote:


----- Original Message -----
>
> Hi Dave,
>
>
> I notice there was some discussion around on enabling
> the display function parameters feature for crash tool.
> Like this one:
> http://www.redhat.com/archives/crash-utility/2009-May/msg00016.html

Yes, it seems to come up every few years.  People have tried, but it
has never come to fruition.

>
> Although the answer seems to be quite clear, it should be hard to
> support such feature. But does this feature cannot be done anyway?
> I think this feature would be great in assisting kernel debug.
>
> The main feature I require, first should be know each param's value
> in the call stack.
> Then it is better to know each call stack's param's name.
>
> Like for do_vfs_ioctl function, it is better to display as:
> do_vfs_ioctl(filp=xxx, fd=xxx, cmd=xxx, arg=xxx)
>
> Do you have any idea on how this could be implemented?

No I don't.

Sorry for asking the stupid question, but I notice that we could
get the structure member in crash by "struct" command:
crash> struct stackframe
struct stackframe {
    long unsigned int fp;
    long unsigned int sp;
    long unsigned int lr;
    long unsigned int pc;
}
SIZE: 16

I check the crash code, and find cmd_struct use gdb interface to parse it out.

And the gdb itself seems already could parse out function argument[1], so could
we still use similar mechanism as the "struct" command to implement a "func"
command, which could shows the function declaration?


Reference:
[1] http://www.chemie.fu-berlin.de/chemnet/use/info/gdb/gdb_7.html
GDB could shows the function param string and corresponding value
#0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) 
    at builtin.c:993
#1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
#2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08)
    at macro.c:71
(More stack frames follow...)
Thanks,
Lei