This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to deference a pointer to pointer
- From: fche at redhat dot com (Frank Ch. Eigler)
- To: Zhiwei Ying <zhiwei dot ying at gmail dot com>
- Cc: systemtap <systemtap at sources dot redhat dot com>
- Date: Tue, 19 Apr 2011 10:41:54 -0400
- Subject: Re: How to deference a pointer to pointer
- References: <BANLkTi=HwOwi=i42OihuzqyYuiQRUOCCjg@mail.gmail.com>
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