From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by sourceware.org (Postfix) with ESMTPS id 29E1C3850426 for ; Wed, 13 Jan 2021 08:59:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 29E1C3850426 Received: by mail-yb1-xb29.google.com with SMTP id k78so1444185ybf.12 for ; Wed, 13 Jan 2021 00:59:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GCQ5C5sllypH0adYQUnj07QjkEwbgsB8iIwQ1MsfQhs=; b=bV5B+xaQ5IYRdFlyHY1FnNl3uPRqmkgUcP+fn24R31pve8dcgvpKL4iMOvHWs0awUf cMsCeA9WnkLZFCv9v2ZLM2xja6sNNUypq0uQcMrAUSCY8VNeuREnUJ7PEuFo1xW8+iAr 8quJUJxB1oHSxZmSImINgSlGLIzV5ah+hcN4RYrAff38cAEvBJi81eap5VkhP63c+mFK mwbNNWBcaOR2velP/I78VwcN61XQfiF/lTpj5xP0XBM/QidJGxxymFmb/GAXmcz2loDR yBr/AxYNtiGV4hpo9JHNDY6cL07uDmalT8kv5jw2toRVfClIscAPzZZarSzUTP7J5MVK eRAw== X-Gm-Message-State: AOAM532FrSQ7rx4tryn5oj9FLvalYm91JLQol2ILCxOPqPEWk0PKnJ/w PqXu8FB830XfKYY9L/1fGKx352Bvkz2yWkEyPes= X-Google-Smtp-Source: ABdhPJxxKDszj6cl/U2gV8UtNCsz6TJSnsIx1FW7l5u2PzKmGEOT7DG6cdLdxPQtpz2r6zvcfZRFcgOdbwEiuwW8Pvc= X-Received: by 2002:a25:76c3:: with SMTP id r186mr2037740ybc.226.1610528383799; Wed, 13 Jan 2021 00:59:43 -0800 (PST) MIME-Version: 1.0 References: <87mtxgr9mu.fsf@redhat.com> In-Reply-To: From: David McRay Date: Wed, 13 Jan 2021 16:59:33 +0800 Message-ID: Subject: Re: It's confused that local variable's value not change in function.return probe. To: Craig Ringer Cc: "Frank Ch. Eigler" , systemtap@sourceware.org X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2021 08:59:45 -0000 Thanks.Got that. Craig Ringer =E4=BA=8E2021=E5=B9=B41=E6=9C=8813=E6= =97=A5=E5=91=A8=E4=B8=89 =E4=B8=8B=E5=8D=8812:37=E5=86=99=E9=81=93=EF=BC=9A > 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.retur= n >> > 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 reflec= t > 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 >