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: Systemtap puzzle


Hi,

You can have a look at http://sourceware.org/ml/systemtap/2012-q1/msg00025.html. There was no real follow-up but it give some hints about what is read at function entry and at function return (you can double check in source code by compiling script with -k option to keep source code, eventually need to add -p4 to not run script)

I think you fall in the case "custom_function" and "custom_get_...()" in this mail.

Note that, even if you probe only return a function, an entry probe may be created to compute some values

Regards
Fred

OMAP Platform Business Unit - System Platform Engineering - Platform & Product Entitlement

>
Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920

-----Original Message-----
>From: systemtap-owner@sourceware.org [mailto:systemtap-owner@sourceware.org] On Behalf Of Frank Ch.
>Eigler
>Sent: Monday, August 06, 2012 1:31 PM
>To: Max Matveev
>Cc: systemtap@sourceware.org
>Subject: Re: Systemtap puzzle
>
>Hi, Max -
>
>makc wrote:
>
>> [...] I'm getting correct values in .return probe if I push
>> the pointer into a function and I'm getting zeros if I look at the
>> values directly, e.g:
>>
>> [root@rebecca ~]# stap e1000e.stap
>> direct ffff81000ce47cd8: speed 0, duplex 0
>> func ffff81000ce47cd8: speed 1000, duplex 1
>>
>> the script is very simple
>>
>> function get_speed(cmd:long)
>> {
>>      printf("func %x: speed %d, duplex %d\n", cmd,
>>              @cast(cmd, "struct ethtool_cmd")->speed,
>>              @cast(cmd, "struct ethtool_cmd")->duplex);
>> }
>> probe module("e1000").function("e1000_get_settings").return {
>>      printf("direct %x: speed %d, duplex %d\n", $ecmd,
>>              $ecmd->speed, $ecmd->duplex);
>>      get_speed($ecmd);
>> }
>
>The difference may be what is saved at function entry time.  You're in
>a .return probe, so $ecmd expressions are snapshots from the
>function's entry time.  So the probe-module printf may simply be
>printing the entry-time fields of that struct; the function OTOH is
>printing the return-time values (since only $ecmd is saved for that
>call, not $ecmd-casted-dereferenced).
>
>You might try using the more formal @entry($ecmd) vs
>@entry($ecmd->field) syntax to help spell out the magic you want.
>
>
>> This is systemtap 1.1-3.el5.
>
>(That's rather old; @entry() arrived in 1.3; stap 1.6 has been
>released within rhel5, and it'll likely be updated soon.)
>
>
>- FChE


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