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, 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]