public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/11598] New: @defined() with @cast() oddity
@ 2010-05-13 23:38 dsmith at redhat dot com
  2010-05-14 14:26 ` [Bug translator/11598] " jistone at redhat dot com
  2010-05-14 17:34 ` [Bug translator/11598] @defined() should allow the address-of operator "&" jistone at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dsmith at redhat dot com @ 2010-05-13 23:38 UTC (permalink / raw)
  To: systemtap

Using the following script:

====
probe begin
{
    printf("%d\n", &@cast(0, "task_struct", "kernel<linux/sched.h>")->pid)
    printf("%d\n", @defined(@cast(0, "task_struct", "kernel<linux/sched.h>")->pid)
           ? 1 : 0)
    printf("%d\n", &@cast(0, "task_struct", "kernel<linux/sched.h>")->rcu)      
    printf("%d\n", @defined(@cast(0, "task_struct", "kernel<linux/sched.h>")->rcu)
           ? 1 : 0)                                                            
       
}                                                                               
====

I see this output:

# stap ../tst.stp
540
1
1276
0

I don't see why the last @defined is coming out false instead of true (like the
1st @defined).

-- 
           Summary: @defined() with @cast() oddity
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: dsmith at redhat dot com


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

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/11598] @defined() with @cast() oddity
  2010-05-13 23:38 [Bug translator/11598] New: @defined() with @cast() oddity dsmith at redhat dot com
@ 2010-05-14 14:26 ` jistone at redhat dot com
  2010-05-14 17:34 ` [Bug translator/11598] @defined() should allow the address-of operator "&" jistone at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2010-05-14 14:26 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From jistone at redhat dot com  2010-05-13 21:23 -------
(In reply to comment #0)
>     printf("%d\n", &@cast(0, "task_struct", "kernel<linux/sched.h>")->rcu)      
>     printf("%d\n", @defined(@cast(0, "task_struct", "kernel<linux/sched.h>")->rcu)
>            ? 1 : 0)                                                            

> I don't see why the last @defined is coming out false instead of true (like the
> 1st @defined).

It's because @defined works by checking whether the $target of @cast would
normally be a valid access.  If you tried this case, you'd get:

  semantic error: 'struct rcu_head' is being accessed instead of a member

That's why the printf still works with a '&' in front -- just use the same
thing: @defined(&@cast(...)->rcu)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug translator/11598] @defined() should allow the address-of operator "&"
  2010-05-13 23:38 [Bug translator/11598] New: @defined() with @cast() oddity dsmith at redhat dot com
  2010-05-14 14:26 ` [Bug translator/11598] " jistone at redhat dot com
@ 2010-05-14 17:34 ` jistone at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jistone at redhat dot com @ 2010-05-14 17:34 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From jistone at redhat dot com  2010-05-13 21:35 -------
(In reply to comment #1)
> just use the same thing: @defined(&@cast(...)->rcu)

Sorry, I should have tested my own advice -- the parser doesn't understand the
'&', but it should.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|systemtap at sources dot    |jistone at redhat dot com
                   |redhat dot com              |
             Status|WAITING                     |ASSIGNED
            Summary|@defined() with @cast()     |@defined() should allow the
                   |oddity                      |address-of operator "&"


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

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-13 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-13 23:38 [Bug translator/11598] New: @defined() with @cast() oddity dsmith at redhat dot com
2010-05-14 14:26 ` [Bug translator/11598] " jistone at redhat dot com
2010-05-14 17:34 ` [Bug translator/11598] @defined() should allow the address-of operator "&" jistone at redhat dot com

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).