From: fche@redhat.com (Frank Ch. Eigler)
To: David McRay <mcmggradty1991@gmail.com>
Cc: systemtap@sourceware.org
Subject: Re: It's confused that local variable's value not change in function.return probe.
Date: Sun, 10 Jan 2021 12:20:42 -0500 [thread overview]
Message-ID: <87mtxgr9mu.fsf@redhat.com> (raw)
In-Reply-To: <CAJnvFBJsAOd-8L+phK8AhspdvY9Ov3SCD7cCPhUXHdRMzF=2qA@mail.gmail.com>
David McRay wrote:
> It's confused that local variable's value not change in function.return
> probe. [...]
>>>>> running stap <<<<
> gcc tests/TestStap.c -O0 -o build/TestStapC -ggdb -gdwarf
>
> # stap tracker.stp -c ./build/TestStapC
> WARNING: confusing usage, consider @entry($a->$) in .return probe:
> identifier '$a$' at scripts/track_cplusplus/track_c.stp:11:28
> source: printf("return a: %s\n", $a$)
The warning message is on topic. If in a .return probe, you access a
general $context variable, this refers to a saved snapshot of the
variable as evaluated at function-entry time. See also [man stapprobes]
If you wish to look at the fields of a->* -after- the function returns,
you can use something like:
@cast(@entry(&$a),"Co")$
instead of
$a$
which works by saving only the address of $a, and
dereferencing/pretty-printing it at return time.
... though we should be able to automate that, in the future, down to
@entry(&$a)$
with a little better dwarf type inference.
- FChE
next prev parent reply other threads:[~2021-01-10 17:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-06 6:40 David McRay
2021-01-10 17:20 ` Frank Ch. Eigler [this message]
2021-01-13 4:37 ` Craig Ringer
2021-01-13 8:59 ` David McRay
2021-01-14 21:47 ` 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=87mtxgr9mu.fsf@redhat.com \
--to=fche@redhat.com \
--cc=mcmggradty1991@gmail.com \
--cc=systemtap@sourceware.org \
/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).