On Mon, Sep 24, 2012 at 11:00 PM, Dave Anderson <anderson@redhat.com> wrote:


----- Original Message -----

> >
> Do you mean if I want to display out something like:
> int do_vfs_ioctl(struct file * filp, unsigned int fd, unsigned int cmd, long unsigned int arg);
> I need to use the tmpfile to pass "filp, fd, cmd, arg" to "whatis"?
>
> But the reality is that I don't know how to let crash extract the four parameter name,
> then how could I pass this info to the tmpfile?
>
> Also the interest of me is get the output as:
>  do_vfs_ioctl(filp,  fd,  cmd,  arg);
> The parameter's type may not need to be displayed as the whatis case.
>
> Thanks,
> Lei


Ah OK, I misunderstood your first question.

As far as getting the parameter names themselves, there is no helper
function that does that.  There are two ways of accessing gdb
functionality -- either:

(1) a gdb command string can be issued unmodified via the
    gdb_pass_through() function, or
(2) a specific pre-existing gdb helper function may be accessed
    via gdb_interface(), which ends up in the gdb_command_funnel()
    function in gdb-7.3-1/gdb/symtab.c.

with respect to (1), ideally there would be some other gdb command
string that you could pass unmodified to gdb to get what you want,
but I don't know of any.

With respect to (2), the gdb_command_funnel() function has a switch
statement for a list of several pre-existing "req->command" definitions,
but none of them pull out the actual names of text function arguments.
I would guess that the argument name strings could be pulled out with
a new gdb helper function, but you'd have to write it yourself.


I find print_frame_args in gdb/stack.c seems to be the function to print out
the argument's name. Its working mechanism is exacting out all symbols
in the specified function with ALL_BLOCK_SYMBOLS. Then discard
those symbol not as argument by SYMBOL_IS_ARGUMENT.
At last it would get the argument name by SYMBOL_PRINT_NAME.

So how could I reach this print_frame_args by crash, need modify gdb side
to create such helper function?
I am not familiar with the gdb modification...
Is there any example to show me how to do this change?
It is better that the example itself contains how to connect the change with crash. :)

Thanks,
Lei