public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "Kai Wong" <kai_wong@symantec.com>
To: <systemtap@sources.redhat.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>
Subject: RE: question regarding accessing a target variable
Date: Sat, 24 Jan 2009 14:27:00 -0000	[thread overview]
Message-ID: <1A193CCB5218B14589B1979BC7D510E00802F544@TUS1XCHCLUPIN11.enterprise.veritas.com> (raw)
In-Reply-To: <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 

  parent reply	other threads:[~2009-01-23 23:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 22:52 help needed to probe own modules Kai_Wong
2008-10-29  1:15 ` Frank Ch. Eigler
     [not found]   ` <1A193CCB5218B14589B1979BC7D510E006F0EB1E@TUS1XCHCLUPIN11.enterprise.veritas.com>
     [not found]     ` <20081029201826.GC16968@redhat.com>
     [not found]       ` <1A193CCB5218B14589B1979BC7D510E006F0ECBC@TUS1XCHCLUPIN11.enterprise.veritas.com>
     [not found]         ` <1A193CCB5218B14589B1979BC7D510E007077719@TUS1XCHCLUPIN11.enterprise.veritas.com>
     [not found]           ` <20081104152629.GB28139@redhat.com>
     [not found]             ` <1A193CCB5218B14589B1979BC7D510E0070F51F0@TUS1XCHCLUPIN12.enterprise.veritas.com>
     [not found]               ` <20081107020842.GG20928@redhat.com>
2009-01-02 22:30                 ` question regarding accessing a target variable Kai Wong
2009-01-03  1:00                   ` Frank Ch. Eigler
2009-01-03  1:30                 ` Kai Wong
2009-01-03 13:50                   ` Frank Ch. Eigler
2009-01-06  0:26                 ` Kai Wong
2009-01-24 14:27                 ` Kai Wong [this message]
2009-01-25  2:44                   ` Frank Ch. Eigler
     [not found]                 ` <1A193CCB5218B14589B1979BC7D510E00802FAFC@TUS1XCHCLUPIN12.enterprise.veritas.com>
2009-01-27 21:40                   ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1A193CCB5218B14589B1979BC7D510E00802F544@TUS1XCHCLUPIN11.enterprise.veritas.com \
    --to=kai_wong@symantec.com \
    --cc=fche@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).