Re: Debugging functions for kernel modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arshad,

Printing values for the structures from the debugger is good for
userspace programs, because we all know that running kernel through
gdb is not an easy job for a newbie. Also virtualization softwares
like UML still don't work 100% with gdb so I thought printing values
would be a simple and useful idea.


On Jan 1, 2008 12:00 PM, arshad hussain <arshad.super@xxxxxxxxx> wrote:
>
>
>
>
> 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.
>
>
>
>
>



-- 
Thanks & Regards,
********************************************
Manish Katiyar  ( http://mkatiyar.googlepages.com )
3rd Floor, Fair Winds Block
EGL Software Park
Off Intermediate Ring Road
Bangalore 560071, India
***********************************************

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux