This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: question regarding accessing a target variable
- From: "Kai Wong" <kai_wong at symantec dot com>
- To: <systemtap at sources dot redhat dot com>
- Cc: "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Fri, 23 Jan 2009 16:11:11 -0700
- Subject: RE: question regarding accessing a target variable
- References: <20217654.post@talk.nabble.com> <y0mtzawurrj.fsf@ton.toronto.redhat.com> <1A193CCB5218B14589B1979BC7D510E006F0EB1E@TUS1XCHCLUPIN11.enterprise.veritas.com> <20081029201826.GC16968@redhat.com> <1A193CCB5218B14589B1979BC7D510E006F0ECBC@TUS1XCHCLUPIN11.enterprise.veritas.com> <1A193CCB5218B14589B1979BC7D510E007077719@TUS1XCHCLUPIN11.enterprise.veritas.com> <20081104152629.GB28139@redhat.com> <1A193CCB5218B14589B1979BC7D510E0070F51F0@TUS1XCHCLUPIN12.enterprise.veritas.com> <20081107020842.GG20928@redhat.com>
Hi,
Although the "volatile" directive as in
<http://sources.redhat.com/systemtap/wiki/TipContextVariables> works in
most cases, it doesn't help if the target variable is used to merely
cast a function parameter as something else. For example, if I have a
probe to the following function:
void dummy_function(void *a) {
typedef struct {
int x;
int y;
} b_t;
b_t *b = (b_t*)a;
...
}
I can't access the target variables x and y in a systemtap script using
$b->x and $b->y (I get " semantic error: not accessible at this
address").
Is there any support in the systemtap script language that lets me
access x and y without having to write a separate embedded-c function
for each as follows?
%{
typedef struct {
int x;
int y;
} b_t;
%}
function get_x:long (a:long) %{
b_t *b = (b_t *)(long)THIS->a;
THIS->__retvalue = deref(sizeof(b->x), &(b->x));
if (0) {
deref_fault:
CONTEXT->last_error = "pointer dereference fault";
}
%}
function get_y:long (a:long) %{
b_t *b = (b_t *)(long)THIS->a;
THIS->__retvalue = deref(sizeof(b->y), &(b->y));
if (0) {
deref_fault:
CONTEXT->last_error = "pointer dereference fault";
}
%}
Or, if you see a simpler method to this, that'll also be helpful.
Kai
-----Original Message-----
From: Kai Wong
Sent: Monday, January 05, 2009 4:25 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: RE: question regarding accessing a target variable
Importance: High
FChE wrote:
> It should not, in any material way. You can confirm with measurements
> of course, or by looking over the assembly/object code before & after.
It works, without any measurable performance degradation. Thank you very
much!!
-Kai
-----Original Message-----
From: Kai Wong
Sent: Friday, January 02, 2009 5:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: RE: question regarding accessing a target variable
FChE wrote:
> I jotted some melancholy notes on this in the wiki.
> http://sources.redhat.com/systemtap/wiki/TipContextVariables
If none of the other options applies or works, but I can modify the
source of the probed software, does
inserting inline-assembly directives as shown in that example slow down
the performance of the probed software when not probed (assuming the
"volatile" directives stays)?
-Kai
-----Original Message-----
From: Kai Wong
Sent: Friday, January 02, 2009 2:29 PM
To: 'systemtap@sources.redhat.com'
Cc: 'Frank Ch. Eigler'
Subject: question regarding accessing a target variable
Hi,
I try to access a target variable (e.g., block, which is a c local
variable within a probed function), but no matter what line number I
place the probe within the function (e.g., probe
module("vxglm").statement("vxg_recv_block_grant@/home2/kwong/glm-bld/50m
p3_clustrace/kernel/glm/smp/glmbpxy.c:67")), I get the following
message:
semantic error: not accessible at this address: identifier '$block' at
/usr/share/systemtap/tapset/glm/msgsup.stp:20:123
that target variable was actually assigned a valid value and referenced
in many different lines within the probed function. I have no trouble
with other target variables that are c local variables.
What can I do to make a c local variable more accessible to systemtap as
a target variable?
Kai