diff options
author | Josh Stone <jistone@redhat.com> | 2009-02-18 17:59:14 -0800 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-02-18 17:59:54 -0800 |
commit | 60ea929119a82b462bc32dd42a48972ee04420e0 (patch) | |
tree | e069aa432873f6f300445278f437a1d6a73e52b5 /stap.1.in | |
parent | 38b925085d04328c9c0511fc6a7de95a64867835 (diff) | |
download | systemtap-steved-60ea929119a82b462bc32dd42a48972ee04420e0.tar.gz systemtap-steved-60ea929119a82b462bc32dd42a48972ee04420e0.tar.xz systemtap-steved-60ea929119a82b462bc32dd42a48972ee04420e0.zip |
Add NEWS and manpage info about @cast()
Diffstat (limited to 'stap.1.in')
-rw-r--r-- | stap.1.in | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -755,6 +755,46 @@ probe end { } .ESAMPLE +.SS TYPECASTING +Once a pointer has been saved into a script integer variable, the +translator loses the type information necessary to access members from +that pointer. Using the +.I @cast() +operator tells the translator how to read a pointer. +.SAMPLE +@cast(p, "type_name"[, "module"])->member +.ESAMPLE +.PP +This will interpret +.I p +as a pointer to a struct/union named +.I type_name +and dereference the +.I member +value. The optional +.I module +tells the translator where to look for information about that type. If +the module is not specified, it will default either to the probe module +for dwarf probes, or to "kernel" for functions and all other probes +types. +.PP +When in guru mode, the translator will also allow scripts to assign new +values to members of typecasted pointers. +.PP +Typecasting is also useful in the case of +.I void* +members whose type may be determinable at runtime. +.SAMPLE +probe foo { + if ($var->type == 1) { + value = @cast($var->data, "type1")->bar + } else { + value = @cast($var->data, "type2")->baz + } + print(value) +} +.ESAMPLE + .SS EMBEDDED C When in guru mode, the translator accepts embedded code in the script. Such code is enclosed between @@ -1076,6 +1116,8 @@ probe specifications that refer to inline functions .IP \(bu 4 statements that refer to $target variables .IP \(bu 4 +statements that refer to @cast() variables +.IP \(bu 4 tapset-defined variables defined using any of the above constructs. In particular, at this writing, the prologue blocks for certain aliases in the syscall tapset |