make search.h, locale.h and libint.h optional

Some environments (like Android) don't have them.

Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
android: disable unsupported function using ifdef__ANDROID__

Change-Id: Id03a17d0e39ae1ec149fae4f656aba6772ab794a
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

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

For: AIA-452
Change-Id: I556065513bad3080410ed1f0ad517315426ed9e5
Depends-Change-Id: Ied47b8059b046848437b870088a3fa4e08c9bccc
Author: Negreanu Marius Adrian <adrian.m.negreanu@intel.com>
Author: Dragos Tatulea <dragos.tatulea@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.

Change-Id: I2f1f646fa89c57f54e8371a715e7fe94959f6abb
Signed-off-by: Dragos Tatulea <dragos.tatulea@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.

Change-Id: I12676695f1a993a8ae2d935681b38de6c83ebdeb
Signed-off-by: Dragos Tatulea <dragos.tatulea@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.

Change-Id: Iab50ebb7d2f5ada9252fb7465a3f17ed7c192afb
Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
Signed-off-by: Matt Gumbel <matthew.k.gumbel@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.

Change-Id: I8eb0a4bba2f7e5e12c77305dfda99c459e9e55ad
Signed-off-by: Dragos Tatulea <dragos.tatulea@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.

Issue: AXIA-917
Change-Id: Ia89db4a48df90f059aa962866435892b5942e85f
Signed-off-by: Alin Dobre <alin.m.dobre@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.

Change-Id: I3cc9c4b7ee274f37ae780b5112e2dc4072213e35
Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
android: switch from static to shared elfutils

Needed to use ebl backend.

Change-Id: I005b2a324bdf5fe331a66efc1a69f956cb40d101
Depends-Change-Id: Ie29be65f2422adabda2d320f778291e1db997b88
Signed-off-by: Dragos Tatulea <dragos.tatulea@intel.com>
stapify: add -P to stop after .ko was adb Pushed

Change-Id: Id029e5e62a46e3f368b6fb29fdf4720979106bf9
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.

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

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

Change-Id: Ifaf2e36e1c0dd7e8378f7ea3d537bca6d3c8a2cf
stapify: style changes

Change-Id: I1fde49d1955455c7f2902d76ffad5616a4514d5a
add support for aarapovs' uretprobes

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