public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* How to deference a pointer to pointer
@ 2011-04-19  9:30 Zhiwei Ying
  2011-04-19 14:42 ` Frank Ch. Eigler
  0 siblings, 1 reply; 4+ messages in thread
From: Zhiwei Ying @ 2011-04-19  9:30 UTC (permalink / raw)
  To: systemtap

Hi,

I know systematap has limited support on tracing of struct field.

Can it trace a field in a pointer to pointer?
struct A
{
  int x;
};
void foo(struct A **a);

How can I trace the field x in struct A?

Thanks,
Zhiwei

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

* Re: How to deference a pointer to pointer
  2011-04-19  9:30 How to deference a pointer to pointer Zhiwei Ying
@ 2011-04-19 14:42 ` Frank Ch. Eigler
  2011-04-20  1:55   ` Zhiwei Ying
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Ch. Eigler @ 2011-04-19 14:42 UTC (permalink / raw)
  To: Zhiwei Ying; +Cc: systemtap

Zhiwei Ying <zhiwei.ying@gmail.com> writes:

> [...]
> I know systematap has limited support on tracing of struct field.

Yes, you can navigate pointers/array.  The syntax for this is similar
to but not the same as C.

> Can it trace a field in a pointer to pointer?
> struct A
> {
>   int x;
> };
> void foo(struct A **a);
>
> How can I trace the field x in struct A?

Yes, this is one of those cases where the syntax doesn't help enough.

probe FOO.function("foo") { println($a->x) }

So two levels of dereferencing are hidden in the single ->.

- FChE

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

* Re: How to deference a pointer to pointer
  2011-04-19 14:42 ` Frank Ch. Eigler
@ 2011-04-20  1:55   ` Zhiwei Ying
  2011-04-20  7:32     ` Turgis, Frederic
  0 siblings, 1 reply; 4+ messages in thread
From: Zhiwei Ying @ 2011-04-20  1:55 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: systemtap

Thanks.

Zhiwei

On Tue, Apr 19, 2011 at 10:41 PM, Frank Ch. Eigler <fche@redhat.com> wrote:
> Zhiwei Ying <zhiwei.ying@gmail.com> writes:
>
>> [...]
>> I know systematap has limited support on tracing of struct field.
>
> Yes, you can navigate pointers/array.  The syntax for this is similar
> to but not the same as C.
>
>> Can it trace a field in a pointer to pointer?
>> struct A
>> {
>>   int x;
>> };
>> void foo(struct A **a);
>>
>> How can I trace the field x in struct A?
>
> Yes, this is one of those cases where the syntax doesn't help enough.
>
> probe FOO.function("foo") { println($a->x) }
>
> So two levels of dereferencing are hidden in the single ->.
>
> - FChE
>

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

* RE: How to deference a pointer to pointer
  2011-04-20  1:55   ` Zhiwei Ying
@ 2011-04-20  7:32     ` Turgis, Frederic
  0 siblings, 0 replies; 4+ messages in thread
From: Turgis, Frederic @ 2011-04-20  7:32 UTC (permalink / raw)
  To: Zhiwei Ying, Frank Ch. Eigler; +Cc: systemtap

Hi,

As answered to 1 of my question earlier, script syntax "->" is not related to C dereferencing "->". Generated code uses in fact dwarf so don't hesitate to try cascading "->"

For example, I print V4L2 buffers address when a video frame is queued with $q->bufs[$b->index]->baddr

And if things do not seem to work, I guess you can revert to "pure" code to directly write plain C code.

Regards
FRed


Frederic Turgis

OMAP Platform Business Unit - OMAP System Engineering - Platform Enablement



Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920

-----Original Message-----

From: systemtap-owner@sourceware.org [mailto:systemtap-owner@sourceware.org] On Behalf Of Zhiwei Ying
Sent: Wednesday, April 20, 2011 3:55 AM
To: Frank Ch. Eigler
Cc: systemtap
Subject: Re: How to deference a pointer to pointer

Thanks.

Zhiwei

On Tue, Apr 19, 2011 at 10:41 PM, Frank Ch. Eigler <fche@redhat.com> wrote:
> Zhiwei Ying <zhiwei.ying@gmail.com> writes:
>
>> [...]
>> I know systematap has limited support on tracing of struct field.
>
> Yes, you can navigate pointers/array.  The syntax for this is similar
> to but not the same as C.
>
>> Can it trace a field in a pointer to pointer?
>> struct A
>> {
>>   int x;
>> };
>> void foo(struct A **a);
>>
>> How can I trace the field x in struct A?
>
> Yes, this is one of those cases where the syntax doesn't help enough.
>
> probe FOO.function("foo") { println($a->x) }
>
> So two levels of dereferencing are hidden in the single ->.
>
> - FChE
>

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

end of thread, other threads:[~2011-04-20  7:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19  9:30 How to deference a pointer to pointer Zhiwei Ying
2011-04-19 14:42 ` Frank Ch. Eigler
2011-04-20  1:55   ` Zhiwei Ying
2011-04-20  7:32     ` Turgis, Frederic

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