public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Dereferencing simple pointers
@ 2009-11-24 17:42 daniel-kay3
  2009-11-24 19:47 ` Frank Ch. Eigler
  0 siblings, 1 reply; 4+ messages in thread
From: daniel-kay3 @ 2009-11-24 17:42 UTC (permalink / raw)
  To: systemtap

Hello Folks,
I am playing around with systemtap and am quite impressed. But there is one thing that confuses me. Is there any way that I can derefernce a single pointer from a function parameter inside a probe?

Example:

# Function from current Kernel (drivers/char/random.c:1049):
urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{
       return extract_entropy_user(&nonblocking_pool, buf, nbytes);
}

# My Probe Attempt without success:
probe kernel.function("urandom_read") {
        printf("%s\n", *($ppos));
}

I can't believe that this isn't possible...

Thanks in advance,
Daniel Kay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Dereferencing simple pointers
  2009-11-24 17:42 Dereferencing simple pointers daniel-kay3
@ 2009-11-24 19:47 ` Frank Ch. Eigler
  2009-11-24 19:59   ` Josh Stone
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Ch. Eigler @ 2009-11-24 19:47 UTC (permalink / raw)
  To: daniel-kay3; +Cc: systemtap

daniel-kay3@arcor.de writes:

> I am playing around with systemtap and am quite impressed. But there
> is one thing that confuses me. Is there any way that I can
> derefernce a single pointer from a function parameter inside a
> probe?

> [...]
> # My Probe Attempt without success:
> probe kernel.function("urandom_read") {
>         printf("%s\n", *($ppos));
> }
>
> I can't believe that this isn't possible...

Right, we don't currently use "*" as a derferencing operator, but
instead make a family of functions available:
kernel_{char,...,long,string} and user_{char,...,long,string}:
So if $ppos was a just a random old char* string,

         printf("%s\n", kernel_string($ppos))

- FChE

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Dereferencing simple pointers
  2009-11-24 19:47 ` Frank Ch. Eigler
@ 2009-11-24 19:59   ` Josh Stone
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Stone @ 2009-11-24 19:59 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: daniel-kay3, systemtap

On 11/24/2009 11:47 AM, Frank Ch. Eigler wrote:
> daniel-kay3@arcor.de writes:
> 
>> I am playing around with systemtap and am quite impressed. But there
>> is one thing that confuses me. Is there any way that I can
>> derefernce a single pointer from a function parameter inside a
>> probe?
> 
>> [...]
>> # My Probe Attempt without success:
>> probe kernel.function("urandom_read") {
>>         printf("%s\n", *($ppos));
>> }
>>
>> I can't believe that this isn't possible...
> 
> Right, we don't currently use "*" as a derferencing operator, but
> instead make a family of functions available:
> kernel_{char,...,long,string} and user_{char,...,long,string}:
> So if $ppos was a just a random old char* string,
> 
>          printf("%s\n", kernel_string($ppos))

Another option for pointers to integral types (since $ppos is loff_t*)
is to use an array access, e.g.

	printf("%d\n, $ppos[0])

Array subscripts on pointers are supported since 0.9.9.

Josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Dereferencing simple pointers
@ 2009-11-24 17:27 daniel-kay
  0 siblings, 0 replies; 4+ messages in thread
From: daniel-kay @ 2009-11-24 17:27 UTC (permalink / raw)
  To: systemtap

Hello Folks,
I am playing around with systemtap and am quite impressed. But there is one thing that confuses me. Is there any way that I can derefernce a single pointer from a function parameter inside a probe?

Example:

# Function from current Kernel (drivers/char/random.c:1049):
urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{
       return extract_entropy_user(&nonblocking_pool, buf, nbytes);
}

# My Probe Attempt without success:
probe kernel.function("urandom_read") {
        printf("%s\n", *($ppos));
}

I can't believe that this isn't possible...

Thanks in advance,
Daniel Kay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-24 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-24 17:42 Dereferencing simple pointers daniel-kay3
2009-11-24 19:47 ` Frank Ch. Eigler
2009-11-24 19:59   ` Josh Stone
  -- strict thread matches above, loose matches on Subject: below --
2009-11-24 17:27 daniel-kay

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).