RE: kprobes, is there a way print local variables or parameters using kprobes

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

 



Thanks for the information.
Fyi,There also seems to be Linux Kernel State tracer at 
http://sourceforge.net/projects/lkst/ 


Thanks and Regards
Deepak


-----Original Message-----
From: kernelnewbies-bounce@xxxxxxxxxxxx
[mailto:kernelnewbies-bounce@xxxxxxxxxxxx]On Behalf Of Sudhanshu Goswami
Sent: Friday, March 11, 2005 7:53 AM
To: kernelnewbies@xxxxxxxxxxxx
Subject: Re: kprobes, is there a way print local variables or parameters
using kprobes


Hi,

If you want to print a function's parameters using KProbes you'll have
to use JProbes. With JProbes you register a function's address which
has the same prototype as the function at which you are placing the
probe. When the function in the kernel is called first your handler is
going to be called which will get the copy of all arguments. You can
print those arguments here. Check out these:

struct jprobe (include/linux/kprobes.h) - Just place "entry" address there.
register_jprobe()
unregister_jprobe

In your probe handler remember to call jprobe_return() just before the
end of function.

As far as local variables are concerned you can place a kprobe
somehwere in the middle of the function and then in your pre_handler
you can do some stack tracing hackery to print local variable values.
I guess that's the only way to do that as of now.

Regards,
Sudhanshu

On Fri, 11 Mar 2005 17:24:57 +0530, Kotian, Deepak
<Deepak.Kotian@xxxxxxxxx> wrote:
> > Hi,
> >
> > kprobes,
> > is there any way to print kernel function's local variables or kernel function parameters using kprobes ?
> > Currently, only printing global variables using prinntk seems to be OK from kprobe
> > handler.
> > e.g. strace on the user application side to trace system calls and prints parameters as well, is there something like ktrace
> > to trace linux kernel.
> >
> > Thanks and Regards
> > Deepak
> >
> P.S. Have also posted this query at lkml.
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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