----- Original Message -----
Hi Folks,
I have a second question related to crash. If there are multiple instances
of a structure in the kernel which have the same name, how do I print them
out?
Mark discovered that as of 7ff9554b there is also a new 'struct log' in
printk.c.
crash> struct log
struct log {
u64 ts_nsec;
u16 len;
u16 text_len;
u16 dict_len;
u16 level;
}
SIZE: 16
XFS also has a 'struct log' in fs/xfs/xfs_log_priv.h.
How do we choose which will print?
Thanks,
Ben
Good question. And no good answer.
I'm guessing that when you enter "struct log" as a crash command, it finds
the base kernel's version first?
It's a gdb question actually, and it comes down to gdb's lookup_symbol()
function -- which has an optional "struct block" argument that narrows
down the scope to a particular range of text. But the crash utility does
not use the block argument when calling lookup_symbol() for a data structure
declaration. So whatever you get, you get...
There are a number of places where the "block" argument for a particular
function are determined, but they seem to presume that you're working from
a stack frame, which is not a concept when used with the crash utility,
because it's invoked internally as "gdb vmlinux". I'm guessing that
there are other paths that can be taken to find a legitimate "block" that
will hopefully select the correct structure definition, but I'm not that
familiar with the gdb code to tell you off-hand. And in any case, there's
certainly no way that I'm aware of that it could be done without adding
new functionality to the crash utility and its interface with the embedded
gdb module.
Interesting that nobody's ever brought this up before. There must be
other examples.
Dave