<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>3756</bug_id>
          
          <creation_ts>2013-01-18 13:22:04 +0000</creation_ts>
          <short_desc>crosstap and stap fail in core-image-sato-sdk (pre 1.4M3)</short_desc>
          <delta_ts>2013-02-26 10:08:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>1.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Stefan Stanacar">sstncr</reporter>
          <assigned_to name="Tom Zanussi">tom.zanussi</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>28940</commentid>
    <comment_count>0</comment_count>
    <who name="Stefan Stanacar">sstncr</who>
    <bug_when>2013-01-18 13:22:04 +0000</bug_when>
    <thetext>commit 9eb88ceb39b7d0b8ddc6487e61ce8edadef10ec4

1.Create the trace_open.stp script as follows:
 

probe syscall.open
{
        printf (&quot;%s(%d) open (%s)\n&quot;, execname(), pid(), argstr)
}

2.Bitbake a core-image-sato-sdk image and start it under qemu.
3.Make sure that the ssh service is started on the Qemu machine.
4.From the host machine poky build_dir, run &quot;crosstap root@192.168.7.2 trace_open.stp&quot;.

The script should successfully connect to the qemu machine and there should be presented a list of services(pid, process name) which run on the qemu machine.


Output:

[stefans@firebird yotta]$ crosstap root@192.168.7.2 trace_open.stp 
~/yocto/builds/yotta ~/yocto/builds/yotta
~/yocto/builds/yotta
Checking &quot;/lib/modules/3.4.24-yocto-standard/build/.config&quot; failed with error: No such file or directory
[stefans@firebird yotta]$ 


Same thing if I run stap directly in the image:

root@qemux86-64:~# stap trace_open.stp 
Checking &quot;/lib/modules/3.4.24-yocto-standard/build/.config&quot; failed with error: No such file or directory
root@qemux86-64:~#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29204</commentid>
    <comment_count>1</comment_count>
    <who name="Stefan Stanacar">sstncr</who>
    <bug_when>2013-01-25 16:33:59 +0000</bug_when>
    <thetext>There is a change in commit 8d6e55bf2192524bda84138b5356a2791adbbe61
The output changed  a little bit, but the error is the same
(again this is a core-image-sato-sdk)

[stefans@firebird yotta]$ crosstap root@192.168.7.2 trace_open.stp
~/yocto/builds/yotta ~/yocto/builds/yotta
~/yocto/builds/yotta

Error: No target kernel build found.
Did you forget to create a local build of your image?

&apos;crosstap&apos; requires a local sdk build of the target system
(or a build that includes &apos;tools-profile&apos;) in order to build
kernel modules that can probe the target system.

Practically speaking, that means you need to do the following:
  - If you&apos;re running a pre-built image, download the release
    and/or BSP tarballs used to build the image.
  - If you&apos;re working from git sources, just clone the metadata
    and BSP layers needed to build the image you&apos;ll be booting.
  - Make sure you&apos;re properly set up to build a new image (see
    the BSP README and/or the widely available basic documentation
    that discusses how to build images).
  - Build an -sdk version of the image e.g.:
      $ bitbake core-image-sato-sdk
  OR
  - Build a non-sdk image but include the profiling tools:
      [ edit local.conf and add &apos;tools-profile&apos; to the end of
        the EXTRA_IMAGE_FEATURES variable ]
      $ bitbake core-image-sato

  [ NOTE that &apos;crosstap&apos; needs to be able to ssh into the target
    system, which isn&apos;t enabled by default in -minimal images. ]

Once you&apos;ve build the image on the host system, you&apos;re ready to
boot it (or the equivalent pre-built image) and use &apos;crosstap&apos;
to probe it (you need to source the environment as usual first):

    $ source oe-init-build-env
    $ cd ~/my/systemtap/scripts
    $ crosstap root@192.168.1.xxx myscript.stp

[stefans@firebird yotta]$ 


But on the image:

[stefans@firebird yotta]$ scp trace_open.stp root@192.168.7.2:~/
trace_open.stp                                100%   89     0.1KB/s   00:00    
[stefans@firebird yotta]$ ssh root@192.168.7.2
root@qemux86-64:~# cat trace_open.stp 
probe syscall.open
{
        printf (&quot;%s(%d) open (%s)\n&quot;, execname(), pid(), argstr)
}

root@qemux86-64:~# stap trace_open.stp 
Checking &quot;/lib/modules/3.4.26-yocto-standard/build/.config&quot; failed with error: No such file or directory
root@qemux86-64:~# 
root@qemux86-64:~# rpm -qa | grep systemtap
systemtap-1.8+git0+48fa6b5e1d3e636c34cbd5650370e6f634efc294-r0.x86_64
systemtap-locale-en-1.8+git0+48fa6b5e1d3e636c34cbd5650370e6f634efc294-r0.x86_64
systemtap-dev-1.8+git0+48fa6b5e1d3e636c34cbd5650370e6f634efc294-r0.x86_64
root@qemux86-64:~#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29265</commentid>
    <comment_count>2</comment_count>
    <who name="Tom Zanussi">tom.zanussi</who>
    <bug_when>2013-01-29 00:35:21 +0000</bug_when>
    <thetext>I&apos;ve verified that the path to the build directory containing .config is correct and is being passed into stap.  Something is causing stap to ignore the passed-in value, investigating.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29426</commentid>
    <comment_count>3</comment_count>
    <who name="Tom Zanussi">tom.zanussi</who>
    <bug_when>2013-01-31 23:23:21 +0000</bug_when>
    <thetext>Digging around in the systemtap code, the ssh_remote class&apos;s connect() method clones the associated sytemtap_session, but the copy constructor for systemtap_session doesn&apos;t copy the .kernel_build_tree member, which was set by the -r command-line option.

Copying kernel_build_tree in the constructor fixes the problem, but I need to do it in the correct &apos;C++ way&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29477</commentid>
    <comment_count>4</comment_count>
    <who name="Tom Zanussi">tom.zanussi</who>
    <bug_when>2013-02-02 00:39:45 +0000</bug_when>
    <thetext>Submitted to oe-core list and upstream to the systemtap list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29508</commentid>
    <comment_count>5</comment_count>
    <who name="Tom Zanussi">tom.zanussi</who>
    <bug_when>2013-02-05 01:26:05 +0000</bug_when>
    <thetext>Turns out the problem is passing in x86-64 instead of the underscore version to the -a param of stap.

Testing a fix to the crosstap script now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29587</commentid>
    <comment_count>6</comment_count>
    <who name="Tom Zanussi">tom.zanussi</who>
    <bug_when>2013-02-06 16:41:50 +0000</bug_when>
    <thetext>Fixed in master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=97b7e4f46e2116e9cbaa02efa7d37321fd32b368</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30070</commentid>
    <comment_count>7</comment_count>
    <who name="Stefan Stanacar">sstncr</who>
    <bug_when>2013-02-25 10:58:56 +0000</bug_when>
    <thetext>commmit: 7d22ef28e64de06b6238d0ef9b664c0bee6efa46

I&apos;m seeing the same behaviour with stap/crosstap:
root@qemux86-64:~# cat trace_open.stp 
probe syscall.open
{
        printf (&quot;%s(%d) open (%s)\n&quot;, execname(), pid(), argstr)
}
root@qemux86-64:~# stap trace_open.stp 
Checking &quot;/lib/modules/3.4.28-yocto-standard/build/.config&quot; failed with error: No such file or directory

[stefans@firebird yotta]$ grep 64 `which crosstap`
        x86?64*)
            SYSTEMTAP_TARGET_ARCH=&quot;x86_64&quot;

[stefans@firebird yotta]$ ssh root@192.168.7.2 &apos;which stap&apos;
/usr/bin/stap
[stefans@firebird yotta]$ crosstap root@192.168.7.2 trace_open.stp 
~/yocto/builds/yotta ~/yocto/builds/yotta
~/yocto/builds/yotta

Error: No target kernel build found.
Did you forget to create a local build of your image?

&apos;crosstap&apos; requires a local sdk build of the target system
(or a build that includes &apos;tools-profile&apos;) in order to build
kernel modules that can probe the target system.

Practically speaking, that means you need to do the following:
  - If you&apos;re running a pre-built image, download the release
    and/or BSP tarballs used to build the image.
  - If you&apos;re working from git sources, just clone the metadata
    and BSP layers needed to build the image you&apos;ll be booting.
  - Make sure you&apos;re properly set up to build a new image (see
    the BSP README and/or the widely available basic documentation
    that discusses how to build images).
  - Build an -sdk version of the image e.g.:
      $ bitbake core-image-sato-sdk
  OR
  - Build a non-sdk image but include the profiling tools:
      [ edit local.conf and add &apos;tools-profile&apos; to the end of
        the EXTRA_IMAGE_FEATURES variable ]
      $ bitbake core-image-sato

  [ NOTE that &apos;crosstap&apos; needs to be able to ssh into the target
    system, which isn&apos;t enabled by default in -minimal images. ]

Once you&apos;ve build the image on the host system, you&apos;re ready to
boot it (or the equivalent pre-built image) and use &apos;crosstap&apos;
to probe it (you need to source the environment as usual first):

    $ source oe-init-build-env
    $ cd ~/my/systemtap/scripts
    $ crosstap root@192.168.1.xxx myscript.stp

[stefans@firebird yotta]$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30093</commentid>
    <comment_count>8</comment_count>
    <who name="Tom Zanussi">tom.zanussi</who>
    <bug_when>2013-02-26 00:35:54 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; commmit: 7d22ef28e64de06b6238d0ef9b664c0bee6efa46
&gt; 
&gt; I&apos;m seeing the same behaviour with stap/crosstap:
&gt; root@qemux86-64:~# cat trace_open.stp 
&gt; probe syscall.open
&gt; {
&gt;         printf (&quot;%s(%d) open (%s)\n&quot;, execname(), pid(), argstr)
&gt; }
&gt; root@qemux86-64:~# stap trace_open.stp 
&gt; Checking &quot;/lib/modules/3.4.28-yocto-standard/build/.config&quot; failed with
&gt; error: No such file or directory
&gt; 
&gt; [stefans@firebird yotta]$ grep 64 `which crosstap`
&gt;         x86?64*)
&gt;             SYSTEMTAP_TARGET_ARCH=&quot;x86_64&quot;
&gt; 
&gt; [stefans@firebird yotta]$ ssh root@192.168.7.2 &apos;which stap&apos;
&gt; /usr/bin/stap
&gt; [stefans@firebird yotta]$ crosstap root@192.168.7.2 trace_open.stp 
&gt; ~/yocto/builds/yotta ~/yocto/builds/yotta
&gt; ~/yocto/builds/yotta
&gt; 
&gt; Error: No target kernel build found.
&gt; Did you forget to create a local build of your image?
&gt; 
&gt; &apos;crosstap&apos; requires a local sdk build of the target system
&gt; (or a build that includes &apos;tools-profile&apos;) in order to build
&gt; kernel modules that can probe the target system.
&gt; 
&gt; Practically speaking, that means you need to do the following:
&gt;   - If you&apos;re running a pre-built image, download the release
&gt;     and/or BSP tarballs used to build the image.
&gt;   - If you&apos;re working from git sources, just clone the metadata
&gt;     and BSP layers needed to build the image you&apos;ll be booting.
&gt;   - Make sure you&apos;re properly set up to build a new image (see
&gt;     the BSP README and/or the widely available basic documentation
&gt;     that discusses how to build images).
&gt;   - Build an -sdk version of the image e.g.:
&gt;       $ bitbake core-image-sato-sdk
&gt;   OR
&gt;   - Build a non-sdk image but include the profiling tools:
&gt;       [ edit local.conf and add &apos;tools-profile&apos; to the end of
&gt;         the EXTRA_IMAGE_FEATURES variable ]
&gt;       $ bitbake core-image-sato
&gt; 
&gt;   [ NOTE that &apos;crosstap&apos; needs to be able to ssh into the target
&gt;     system, which isn&apos;t enabled by default in -minimal images. ]
&gt; 
&gt; Once you&apos;ve build the image on the host system, you&apos;re ready to
&gt; boot it (or the equivalent pre-built image) and use &apos;crosstap&apos;
&gt; to probe it (you need to source the environment as usual first):
&gt; 
&gt;     $ source oe-init-build-env
&gt;     $ cd ~/my/systemtap/scripts
&gt;     $ crosstap root@192.168.1.xxx myscript.stp
&gt; 
&gt; [stefans@firebird yotta]$

It looks like this time it&apos;s not finding the .config because the kernel hasn&apos;t been built on the host system, which is required as noted in the instructions.  Have you done what the message says to do for the prerequisites?

Here&apos;s a transcript of running trace_open.stp that worked out of the box for me:

[trz@empanada crosstap-test]$ git checkout -b commit7d22ef28e64de06b6238d0ef9b664c0bee6efa46 7d22ef28e64de06b6\
238d0ef9b664c0bee6efa46
[trz@empanada crosstap-test]$ source oe-init-build-env
[trz@empanada build]$ bitbake core-image-sato-sdk
[trz@empanada build]$ runqemu qemux86-64
^Z
[1]+  Stopped                 runqemu qemux86-64
[trz@empanada build]$ bg 1
[trz@empanada build]$ cd /home/trz/tracing/systemtap/scripts/tutorial
[trz@empanada tutorial]$ crosstap root@192.168.7.2 trace_open.stp
~/tracing/systemtap/scripts/tutorial ~/tracing/systemtap/scripts/tutorial
~/tracing/systemtap/scripts/tutorial
The authenticity of host &apos;192.168.7.2 (192.168.7.2)&apos; can&apos;t be established.
RSA key fingerprint is 67:bd:49:90:55:63:bf:5b:5d:73:36:3d:94:ae:33:77.
Are you sure you want to continue connecting (yes/no)? yes
~/tracing/systemtap/scripts/tutorial
ls(704) open (&quot;/etc/ld.so.cache&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/tls/x86_64/libcap.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/tls/libcap.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/x86_64/libcap.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libcap.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libacl.so.1&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libc.so.6&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libattr.so.1&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/etc/nsswitch.conf&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/etc/ld.so.cache&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libnss_compat.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libnsl.so.1&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/etc/ld.so.cache&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libnss_nis.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/lib/libnss_files.so.2&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/etc/passwd&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/etc/group&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
ls(704) open (&quot;/usr/share/zoneinfo/UTC&quot;, O_RDONLY|O_CLOEXEC|O_CLOEXEC)
matchbox-termin(663) open (&quot;/tmp/vte1S62SW&quot;, O_RDWR|O_CREAT|O_EXCL, 0600)
matchbox-termin(663) open (&quot;/tmp/vteK35RSW&quot;, O_RDWR|O_CREAT|O_EXCL, 0600)
matchbox-termin(663) open (&quot;/tmp/vte9V6RSW&quot;, O_RDWR|O_CREAT|O_EXCL, 0600)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>30106</commentid>
    <comment_count>9</comment_count>
    <who name="Stefan Stanacar">sstncr</who>
    <bug_when>2013-02-26 10:08:06 +0000</bug_when>
    <thetext>(In reply to comment #8)

&gt; 
&gt; It looks like this time it&apos;s not finding the .config because the kernel
&gt; hasn&apos;t been built on the host system, which is required as noted in the
&gt; instructions.  Have you done what the message says to do for the
&gt; prerequisites?
&gt; 

Something is wierd because I did had a build of core-image-sato-sdk, as the instructions recommend. However it was likely rebuilt mostly from sstate. So I wiped my tmp dir, did a bitbake -ccleansstate linux-yocto, and rebuilt core-image-sato-sdk and now indeed it works as advertised.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>