This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: accessing target globals with systemtap


> -----Original Message-----
> From: systemtap-owner@sourceware.org [mailto:systemtap-
> owner@sourceware.org] On Behalf Of Jeff Haran
> Sent: Tuesday, September 11, 2012 6:00 PM
> To: 'Frank Ch. Eigler'
> Cc: 'systemtap@sourceware.org'
> Subject: RE: accessing target globals with systemtap
... 
> > > Is there a way for me to get access to a kernel global in my version of
> stap?
> >
> > Another way would be to use embedded-C:
> >
> > %{
> > #include <net/arp.h>
> > %}
> > function the_table_address:long () %{ /* unmangled */
> >   /* rely on EXPORT_SYMBOL ... to let this resolve */
> >   THIS->__retvalue = & arp_tbl;
> > %}
> > probe begin {
> >   // to find the base address
> >   printf("%p\n", the_table_address())
> >   // to fetch fields:
> >   printf("%d\n", @cast(the_table_address(),"neigh_table","kernel")-
> > >family);
> > }
> 
> I'll give this embedded C a try.

Just an FYI for posterity. The above generated a warning in the C compilation pass, which since warnings are treated as errors meant no .ko file was produced.

But replacing this:

	THIS->__retvalue = & arp_tbl;

with this:

	THIS->__retvalue = (int64_t) & arp_tbl;

built fine and it seems to have worked right too:

[root@s01b05 jharan]# staprun temp4.ko
0xffffffff81b157c0
2
^C[root@s01b05 jharan]#

Thanks again,

Jeff Haran


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]