Bug 3672 - Adopt crosstap script for systemtap
Summary: Adopt crosstap script for systemtap
Status: VERIFIED FIXED
Alias: None
Product: Eclipse Plugin
Classification: Yocto Project Subprojects
Component: eclipse-plugin (show other bugs)
Version: 1.4
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 1.4 M3
Assignee: Ioana Grigoropol
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-01-03 22:37 UTC by Jessica
Modified: 2013-04-16 08:43 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jessica 2013-01-03 22:37:19 UTC
The eclipse plug-in for systemtap should adopt the latest crosstap script for remote systemtap interaction to be consistent
Comment 2 Alexandru Georgescu 2013-02-19 14:41:54 UTC
Hi Jessica, 
Can you help me verify this work with a test scenario or what should I expect to happen?

Thanks,
Alex.
Comment 3 Alexandru Georgescu 2013-04-02 08:16:47 UTC
Hi Jessica,
With the help of profiling wiki: https://wiki.yoctoproject.org/wiki/Tracing_and_Profiling#systemtap , I have tried to run the tool, but I have the following output


1. Added the poky location for the metadata (e.g.: /home/yocto/0327-1/userbuilt/poky)
2. configured the other fields (user, host, systemtap script).
3. Pressed OK.

On the console output I have the following output which I believe is wrong: 



### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-toolchain-sdk
    adt-installer
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

~/0327-1/userbuilt/poky/build ~/0327-1/userbuilt/poky/build
~/0327-1/userbuilt/poky/build




The output should be the same as in the wiki: 
$ crosstap root@192.168.7.2 trace_open.stp 
root@192.168.7.2's password: 
matchbox-termin(1036) open ("/tmp/vte3FS2LW", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600)
matchbox-termin(1036) open ("/tmp/vteJMC7LW", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600)
Comment 4 Jessica 2013-04-04 18:16:24 UTC
Alex,

I've tried and think probably you truncate the error messages that you got, which should be as following.  It explains in detail that you didn't run a kernel build with your metadata, please read how to use systemtap crosstap script on wiki carefully.

Thanks,
Jessica

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-toolchain-sdk
    adt-installer
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'

~/poky/build ~/poky/build
~/poky/build

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

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

Practically speaking, that means you need to do the following:
  - If you're running a pre-built image, download the release
    and/or BSP tarballs used to build the image.
  - If you're working from git sources, just clone the metadata
    and BSP layers needed to build the image you'll be booting.
  - Make sure you'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 'tools-profile' to the end of
        the EXTRA_IMAGE_FEATURES variable ]
      $ bitbake core-image-sato

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

Once you've build the image on the host system, you're ready to
boot it (or the equivalent pre-built image) and use 'crosstap'
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
Comment 5 Adrian Dudau 2013-04-05 14:59:56 UTC
Hi Alex,

Even if you build the kernel/image, you need to make sure that you do that in the poky/build folder. At the moment the plugin uses that folder by default. (It sources oe-init-build-env from poky without a builddir parameter, which leads to the creation of a new poky/build folder if not available). Maybe we should modify the plugin so that the user can choose the build folder as well. 
What do you think Jessica?

Best regards,
--Adrian
Comment 6 Jessica 2013-04-05 22:40:34 UTC
Hi Andrian,

Then probably that's a separate enhancement bug.  If no futher issue with this bug, please close it since we're working on trending down for 1.4 bugs for the release.

Thanks,
Jessica
Comment 7 Adrian Dudau 2013-04-08 12:45:35 UTC
Hi

I created bug https://bugzilla.yoctoproject.org/show_bug.cgi?id=4223 to deal with this. I will start working on a solution for that.

I guess we can close this bug now.

best regards,
--Adrian
Comment 8 Jessica 2013-04-09 22:21:14 UTC
Please refer to comments below...
Comment 9 Alexandru Georgescu 2013-04-10 15:41:23 UTC
(In reply to comment #8)
> Please refer to comments below...

Hi Jessica,
I am sorry but I have to reopen this.

Here is the steps I have tested.

1. clone a poky and checkout the RC3 commit: fe336b149552b1f4f24d979c40302653298b98cc
2. added tools-profile to the local.conf for EXTRA_IMAGE_FEATURES parameter.
3. bitbake linux-yocto
4. bitbake core-image-sato-sdk
5. After all finnished, I started the qemu:
$ runqemu qemux86-64 core-image-sato-sdk

6. Started eclipse and filled in all the data for systemtap script. Then pressed OK.

Now, I don't get the kernel build not found error. Instead, it stops at: 


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-toolchain-sdk
    adt-installer
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
~/0403-2/poky/build-systemtap ~/0403-2/poky/build-systemtap
~/0403-2/poky/build-systemtap


Adrian, Jessica: Have you tried to run this way the plugin and did that work?
 Is there something that I am not doing right?

Regards,
Alex.
Comment 10 Jessica 2013-04-10 15:47:17 UTC
where you run bitbake? inside the meta data build dir or outside? and what are the info you filled in the plugin? please be more specific since they're the key infos for this bug
Comment 11 Alexandru Georgescu 2013-04-10 16:04:28 UTC
(In reply to comment #10)
> where you run bitbake? inside the meta data build dir or outside? and what
> are the info you filled in the plugin? please be more specific since they're
> the key infos for this bug


I ran "bitbake core-image-sato-sdk" inside poky folder (after I have sourced it into build-systemtap dir). 
I created a symlink in order to use the build directory inside poky dir (so that I don't have to rebuild all over again):
[yocto@localhost poky]$ ln -s build-systemtap build

The folder used now is the default one (build)

Started up Eclipse again and set the following settings to systemtap:
Metadata location:
/home/yocto/0403-2/poky/build

User ID: root
remote host: 192.168.7.6

systemtap script: /home/yocto/0403-2/trace.stp

The trace.stp file is:

[yocto@localhost 0403-2]$ cat trace.stp 
probe syscall.open
{
        printf ("%s(%d) open (%s)\n", execname(), pid(), argstr)
}

probe timer.ms(4000) # after 4 seconds
{
        exit ()
}
[yocto@localhost 0403-2]$ 




Please note that now the error for the kernel build does not appear, so the plugin recognizes the kernel build.


In order to make sure, I will try to reproduce this from scratch.
Comment 12 Jessica 2013-04-10 17:38:12 UTC
Alex,

Don't do the symlink for your build directory, you either stick with the outside meta-data build dir or the default build dir within the meta-data directory.  The issue you found is really a corner case which is not typically people doing things.

I'm closing this bug since it's workig as designed.  Please open a separate bug to track your issue which in my mind is a low.
Comment 13 Alexandru Georgescu 2013-04-11 07:24:23 UTC
I am sorry but I have tried with a new clean build using the default dir: "build".
The issue remains the same: nothing happens.

I will paste again the eclipse console output:


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-toolchain-sdk
    adt-installer
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
~/0403-2/poky2/build ~/0403-2/poky2/build
~/0403-2/poky2/build


Tested with: 
eclipse-poky   dylan         e5172830f61b7dcc3ac03d18a03e63389c6b4629
Comment 14 Adrian Dudau 2013-04-11 13:50:35 UTC
Hi Alex,

From the look of it, it seems that your stap script goes through alright. Your code snipped looks a bit odd, are you sure it's correct? Try to run it against your host machine. Or you could also try to manually run the crosstap script with the -v option.

Best regards,
--Adrian
Comment 15 Alexandru Georgescu 2013-04-11 16:09:23 UTC
Hi Adrian, Jessica,

Doing further investigation, the problem is the bug Adrian filed some stap scripts freeze Eclipse when ran from the System Tap plugin https://bugzilla.yoctoproject.org/show_bug.cgi?id=4251 since no output is displayed it is hard to tell if the script implementation works well or not.

Also, trying manually from command line, I couldn't validate the crosstap script since there is a bug blocking it: https://bugzilla.yoctoproject.org/show_bug.cgi?id=4099. 

I propose to have this put on hold until the bug 4099 is fixed.

Regards,
Alex.
Comment 16 Jessica 2013-04-15 15:40:41 UTC
Alex,

let's mark this one as fixed since what this bug is meant to adapt systamtap script changes in Eclipse plug-in which is implemented.  As to other issues, since there're separate bugs tracking them, no need to keep this bug open.

THanks,
Jessica
Comment 17 Alexandru Georgescu 2013-04-16 08:43:54 UTC
OK. 

Verified as per above comment