public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Craig Ringer <craig@2ndquadrant.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: David McRay <mcmggradty1991@gmail.com>, systemtap@sourceware.org
Subject: Re: It's confused that local variable's value not change in function.return probe.
Date: Wed, 13 Jan 2021 12:37:47 +0800	[thread overview]
Message-ID: <CAMsr+YEM21=RpEYo6+1fw87B4Mifu=NwSd8dN5oVd8=OiSFdOA@mail.gmail.com> (raw)
In-Reply-To: <87mtxgr9mu.fsf@redhat.com>

On Mon, 11 Jan 2021 at 01:21, Frank Ch. Eigler via Systemtap <
systemtap@sourceware.org> wrote:

>
> 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]
>

I never found that especially confusing, but I can see how the message
might be improved.

- WARNING: confusing usage, consider @entry($a->$)
+ WARNING: value of  $a is captured at function entry and will not reflect
any changes made since; consider explicitly using @entry($a->$)

or something like that?

Or a subhead hint in "man stapprobes" like "See also [man stapprobes]
heading MORE ON RETURN PROBES".

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise

  reply	other threads:[~2021-01-13  4:38 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
2021-01-13  4:37   ` Craig Ringer [this message]
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='CAMsr+YEM21=RpEYo6+1fw87B4Mifu=NwSd8dN5oVd8=OiSFdOA@mail.gmail.com' \
    --to=craig@2ndquadrant.com \
    --cc=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).