On 12/31/07, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
Hi,
Do we have any helper functions present in the kernel code to print
the information about commonly used data structures in the code which
might help in debugging.
For example something like :
void print_buffer_head(struct buffer_head *bh, char *level){
printk(level "Buffer state = %d \n",bh->b_state);
printk(level "Buffer users = %d\n",bh->b_count);
......
......
/* Print other relevant fields */
return;
}
Similarly for other structures like superblock etc. so that it will
help newbies who are in kernel development to quickly add a debugging
statement and see the values. We can also have a callback if the
structure contains any module/filesystem specific info to be printed.
If they are not present , how about having them ??? Any
thoughts/suggestions/comments/ appreciated.
--
Thanks & Regards,
********************************************
Manish Katiyar ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************
Most debugger allows to make a function call. For complicated data
structures, a function can be written to traverse that data structure.
This function may not be called withing the code , its just needs to
be there.
Now withing the debugger you can manually check the
values of data structure by calling you traverse->print routine.