android: disable unsupported function using ifdef__ANDROID__

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
android: Android.mk and specific fixes for build

There are some limitations for android:
- can't use funky exceptions or code that pulls them in
- don't use .. paths in includes for config files because
it makes it impossible to find them under android/host &
android/target
- added git_version.sh in the build

Author: Negreanu Marius Adrian <adrian.m.negreanu@intel.com>
Author: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
stapify: a script to easily run stap scripts on Android

Author: Negreanu Marius Adrian <adrian.m.negreanu@intel.com>
Author: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
android: fix invalid install of staprun in output dir

Use 2 Android.mk's:
- One in src root for stap
- One in staprun for staprun & stapio

We do this to avoid a bug in the build system that triggers when some sources
are located in a directory that has the same name as the module to be built.
In this case staprun object output dir and staprun linked binary were confusing
the build system.

Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: fix kprobe events by temporarily enabling kallsyms

Kallsysms is completely disabled by default in Android Jelly Bean.
This change enables it for root only while running the stp script.

Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: fix hardcoded path issues

- ANDROID_HOST_OUT is now used to define stap path
- stapify wasn't able to load stap scripts from other than local
directories
- tapset and runtime sources are no longer hardcoded.

Now it's possible to run stapify from any directory with stap
scripts from any directory.

Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: allow usage of files containing -'s

We are using -m stap option to compile the stap module with
the name derived from the script name. But modules can't use
-'s, so change them to _'s.

Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
android: Fixed race condition in git_version.h generation

The stap and staprun targets were based on generation of a
git_version.h file. The generation is being done based on running the
git_version.sh script. However, there were two glitches in the code:
1. The generation script was being run with an output file that didn't
have the full path specified, using the current ($PWD) directory as
output file. And that's because the script itself was not "ready" to
be used with full path.
2. When building Android, all scripts are being run with current
directory, the topmost Android root directory. The git_version.sh
script was usnig the current directory to store the git_version.h,
just before copying it in the *intermediates* target directory. If two
or more instances of the git_version.sh script were being run, they
were using the very same git_version.h file from the Android tree
root. This leads to a race condition.

This patch solves both of these problems, even though it basically
addresses only the first one.

The git_version.sh script was modified to accept a full path when
specifying an output file. So, now, the script can be called directly
with the *intermediates* git_version.h file as parameter. Also, the
two Android.mk files were modified to call the git_version.sh script
properly.

Signed-off-by: Alin Dobre <alin.m.dobre@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: stop running stap on host as root

Go through first 4 steps of stap (parse, elaborate, translate, compile)
which don't need special rights. 5'th step is running and happens on the
device.

Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
android: switch from static to shared elfutils

Needed to use ebl backend.

Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: add -P to stop after .ko was adb Pushed

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: control the verbosity level from the number of V specified

replace the old verbosity level (-vvvvv) with a more flexible one.
so now you can do -VVV for higher verbosity, or -V for basic loging.

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: specify for -D, which runtime we're referring to

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
android: update Android.mk

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
stapify: style changes

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
add support for aarapovs' uretprobes

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>