public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "mjw at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug translator/12609] New: Cannot see variable values in partial inlined functions with gcc 4.6
Date: Mon, 28 Mar 2011 10:34:00 -0000	[thread overview]
Message-ID: <bug-12609-6586@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=12609

           Summary: Cannot see variable values in partial inlined
                    functions with gcc 4.6
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: mjw@redhat.com


Take the following program foo.c:

$ cat foo.c 
/* { dg-options "-g -O2" } */

extern void abort (void);
volatile int v;
#define V1 v++; v++; v++; v++; v++; v++; v++; v++; v++; v++;
#define V2 V1 V1 V1 V1 V1 V1 V1 V1 V1 V1
static int
foo (int x)
{
  int a = 2 * x + 4;
  int b = 6;
  if (x < 30)
    {
      int c = 8;
      int d = 8 * x;
      return 6;
    }
  else
    {
      int e = 134;
      int f = 9 * x;
      V2
      return v + 17;
    }
}

int
main (void)
{
  if (foo (v) > 10000)
    abort ();
  foo (70);
  return 0;
}

Compiled with gcc 4.5 -g -O2 -o foo.old foo.c systemtap is happy to probe the
(inlined) foo and variables:

$ stap -e 'probe process ("./foo.old").function("foo") { printf("%s@0x%x\n",
pp(), uaddr()); log ($$vars) }' -c ./foo.old
process("/tmp/foo.old").function("foo@/tmp/foo.c:8")@0x4004d0
x=0x0 a=0x4 b=0x6
process("/tmp/foo.old").function("foo@/tmp/foo.c:8")@0x4004d0
x=0x46 a=0x90 b=0x6

But compiled with gcc 4.6 (actually my test was with gcc trunk, but that is
still fairly similar) -g -O2 -o foo.new foo.c systemtap is unable to find the
value of most variables:

$ stap -e 'probe process ("./foo.new").function("foo") { printf("%s@0x%x\n",
pp(), uaddr()); log ($$vars) }' -c ./foo.new
process("/tmp/foo.new").function("foo@/tmp/foo.c:8")@0x400aaa
x=0x0
process("/tmp/foo.new").function("foo@/tmp/foo.c:8")@0x4004b0
a=? x=? b=?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

             reply	other threads:[~2011-03-28 10:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 10:34 mjw at redhat dot com [this message]
2011-05-16 21:29 ` [Bug translator/12609] " fche at redhat dot com
2011-05-17  9:21 ` mjw at redhat dot com
2011-05-17  9:28 ` fche at redhat dot com
2011-05-17  9:31 ` mjw at redhat dot com
2020-04-10 14:53 ` fche at redhat dot com
2020-04-11  1:40 ` fche at redhat dot com

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=bug-12609-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --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).