public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Nan Xiao <xiaonan830818@gmail.com>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: systemtap@sourceware.org
Subject: Re: How does stap execute probe aliases?
Date: Sat, 21 Nov 2015 09:06:00 -0000	[thread overview]
Message-ID: <CA+MhoaN0Wc4S5r1pf+Pv-Wf8K0EdGo_F5=soK74GbRkJfXkLuA@mail.gmail.com> (raw)
In-Reply-To: <y0mh9kgodj3.fsf@fche.csb>

Hi Frank,

I instantiate the probe like this:

# cat page_fault.stp
#!/usr/bin/stap -v
probe vm.pagefault = kernel.function("__handle_mm_fault@mm/memory.c") ?,
                     kernel.function("handle_mm_fault@mm/memory.c") ?
{
        name = "pagefault"
        write_access = (@defined($flags)
                        ? $flags & FAULT_FLAG_WRITE : $write_access)
        address =  $address
}

probe vm.pagefault
{
        printf("%s:%d 0x%x\n", name, write_access, address);
}

But executing it outputs the following error:

# ./page_fault.stp
Pass 1: parsed user script and 102 library script(s) using
78244virt/28420res/2684shr/26440data kb, in 110usr/20sys/128real ms.
semantic error: unable to find local 'write_access', [man
error::dwarf] dieoffset 0xe3b727 in kernel, near pc 0xffffffff8012a5dc
in __handle_mm_fault ../mm/memory.c (alternatives: $address, $mm,
$flags, $vma)): identifier '$write_access' at ./page_fault.stp:7:34
        source:                         ? $flags & FAULT_FLAG_WRITE :
$write_access)
                                                                      ^

semantic error: failed to retrieve location attribute for 'address'
[man error::dwarf] (dieoffset: 0xe3b744): identifier '$address' at
:8:13
        source:         address =  $address
                                   ^

semantic error: unable to find local 'write_access', [man
error::dwarf] dieoffset 0xe3b727 in kernel, near pc 0xffffffff8012a5dc
in __handle_mm_fault ../mm/memory.c (alternatives: $address, $mm,
$flags, $vma)): identifier '$write_access' at :7:34
        source:                         ? $flags & FAULT_FLAG_WRITE :
$write_access)
                                                                      ^

semantic error: failed to retrieve location attribute for 'address'
[man error::dwarf] (dieoffset: 0xe3b744): identifier '$address' at
:8:13
        source:         address =  $address
                                   ^

semantic error: unable to find local 'write_access', [man
error::dwarf] dieoffset 0xe3b727 in kernel, near pc 0xffffffff8012a5dc
in __handle_mm_fault ../mm/memory.c (alternatives: $address, $mm,
$flags, $vma)): identifier '$write_access' at :7:34
        source:                         ? $flags & FAULT_FLAG_WRITE :
$write_access)
                                                                      ^

semantic error: failed to retrieve location attribute for 'address'
[man error::dwarf] (dieoffset: 0xe3b744): identifier '$address' at
:8:13
        source:         address =  $address
                                   ^

semantic error: unable to find local 'write_access', [man
error::dwarf] dieoffset 0xe3b727 in kernel, near pc 0xffffffff8012a5dc
in __handle_mm_fault ../mm/memory.c (alternatives: $address, $mm,
$flags, $vma)): identifier '$write_access' at :7:34
        source:                         ? $flags & FAULT_FLAG_WRITE :
$write_access)
                                                                      ^

semantic error: failed to retrieve location attribute for 'address'
[man error::dwarf] (dieoffset: 0xe3b744): identifier '$address' at
:8:13
        source:         address =  $address
                                   ^

Pass 2: analyzed script: 3 probe(s), 4 function(s), 1 embed(s), 1
global(s) using 113032virt/63380res/3620shr/61228data kb, in
360usr/80sys/533real ms.
Pass 2: analysis failed.  [man error::pass2]

Checking the probes:
# stap -L 'kernel.function("__handle_mm_fault@mm/memory.c")'
kernel.function("__handle_mm_fault@../mm/memory.c:3752")
# stap -L 'kernel.function("handle_mm_fault@mm/memory.c")'
kernel.function("handle_mm_fault@../mm/memory.c:3832") $mm:struct
mm_struct* $vma:struct vm_area_struct* $address:long unsigned int
$flags:unsigned int

It seems the probes all exist and OK.

Could you give some clues about this error? Thanks in advance!
Best Regards
Nan Xiao


On Sat, Nov 21, 2015 at 12:12 AM, Frank Ch. Eigler <fche@redhat.com> wrote:
>
> xiaonan830818 wrote:
>
>> I try to execute the following script from this page
>> (https://sourceware.org/systemtap/SystemTap_Beginners_Guide/targetavailable.html#available):
>> [...]
>> Why can't the stap find the probes? Thanks in advance!
>
> Because that script defines aliases only (kind of like a #define FOO BAR
> in a C program), and doesn't instantiate them (FOO in a C program).
> So add
>
>    probe vm.pagefault { /* ... */ }
>
> to your script.
>
> - FChE

  reply	other threads:[~2015-11-21  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20  9:59 Nan Xiao
2015-11-20 16:12 ` Frank Ch. Eigler
2015-11-21  9:06   ` Nan Xiao [this message]
2015-11-21 12:55     ` Frank Ch. Eigler
2015-11-23  1:49       ` Nan Xiao
2015-11-23  1:51         ` Frank Ch. Eigler
2015-11-23  2:01           ` Nan Xiao

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='CA+MhoaN0Wc4S5r1pf+Pv-Wf8K0EdGo_F5=soK74GbRkJfXkLuA@mail.gmail.com' \
    --to=xiaonan830818@gmail.com \
    --cc=fche@redhat.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).