Support the whole 128 feature's bits in library. 51/111151/10
authorAlexander Aksenov <a.aksenov@samsung.com>
Thu, 19 Jan 2017 12:24:50 +0000 (15:24 +0300)
committerAlexander Aksenov <a.aksenov@samsung.com>
Thu, 1 Jun 2017 15:54:17 +0000 (18:54 +0300)
It will be useful to load libraries for preload features,
because they are on the last 64 bits of features now.
Also, features are passed as integers, not as string as before.

This commit is related with swap-manager commit of the same
name.

Change-Id: I4b51dd16cff64a9bdfccc35700298f558836d71c
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
helper/dahelper.c
helper/got_patching.c
helper/libdaprobe.c
helper/lsan_open.c
include/dahelper.h
probe_event/da_event.c
probe_event/gesture.cpp
probe_event/keytouch.c
probe_screenshot/dacapture_wayland.c

index cd4b0dd..84e264d 100755 (executable)
@@ -65,7 +65,10 @@ __traceInfo gTraceInfo = {
        -1,             /* int stateTouch */
        0,              /* int init_complete */
        0,              /* int custom_chart_callback_count */
-       0,              /* unsigned long optionflag */
+       {
+               0,                              /* feature 0 */
+               0                               /* feature 1 */
+       },              /* features_t */
        {
                PTHREAD_MUTEX_INITIALIZER,      /* pthread_mutex_t bins_mutex */
                SLIST_HEAD_INITIALIZER(bins_list) /* struct head = NULL */
index d76f5db..f99a531 100644 (file)
@@ -396,7 +396,7 @@ static void _process_features(void)
 
        for (i = 0; i < features_cnt; i++) {
                if (features[i] == NULL ||
-                   !isOptionEnabled(features[i]->feature))
+                   !isOptionEnabled(features[i]->feature, 0))
                        continue;
                _patch_target_bins(features[i]);
        }
@@ -464,7 +464,7 @@ __dl_fixup_wrapper (
        /* Iterate features to find target probe */
        for (i = 0; i < features_cnt; i++) {
                if (features[i] == NULL ||
-                   !isOptionEnabled(features[i]->feature))
+                   !isOptionEnabled(features[i]->feature, 0))
                        continue;
 
                if (_is_ignored(l->l_name) || (!target_bin &&
@@ -530,7 +530,7 @@ void __dl_reloc_wrapper(struct link_map *l, struct r_scope_elem *scope[],
 
        for (i = 0; i < features_cnt; i++) {
                if (features[i] == NULL ||
-                   !isOptionEnabled(features[i]->feature))
+                   !isOptionEnabled(features[i]->feature, 0))
                        continue;
 
                is_for_all = _is_for_all_feature(features[i]);
index 669941e..bbae52c 100755 (executable)
@@ -89,14 +89,20 @@ enum {
    (this means that these functions do not need to set enter/exit flag)
  ******************************************************************************/
 
+static inline void _parse_config(char *configstr)
+{
+       gTraceInfo.features.feature_0 = *(uint64_t *)configstr;
+       gTraceInfo.features.feature_1 = *(uint64_t *)(configstr + sizeof(uint64_t));
+}
+
 /* runtime configure the probe option */
 static void _configure(char* configstr)
 {
-       gTraceInfo.optionflag = atoll(configstr);
+       _parse_config(configstr);
 
        init_features();
 
-       if (isOptionEnabled(FL_SCREENSHOT)) {
+       if (isOptionEnabled(FL_SCREENSHOT, 0)) {
                load_screenshot_library();
                screenshot_set_call();
        } else {
@@ -104,7 +110,8 @@ static void _configure(char* configstr)
                screenshot_unset_call();
        }
 
-       PRINTMSG("configure in probe : %s, %llx\n", configstr, gTraceInfo.optionflag);
+       PRINTMSG("configure in probe : %llx : %llx\n",
+                gTraceInfo.features.feature_0, gTraceInfo.features.feature_1);
 }
 
 static void _process_target_bins(char *data_buf)
index aaaa3df..20995c1 100644 (file)
@@ -85,8 +85,8 @@ static char *get_report_file_name() {
 
 int lsan_open_liblsan()
 {
-       if (!isOptionEnabled(FL_MEMORY_ALLOC_ALWAYS_PROBING) ||
-           !isOptionEnabled(FL_LSAN))
+       if (!isOptionEnabled(FL_MEMORY_ALLOC_ALWAYS_PROBING, 0) ||
+           !isOptionEnabled(FL_LSAN, 0))
                return 0;
 
        liblsan_handle = dlopen(PROBELIB_LSAN, RTLD_NOW);
index caa9447..21a3bae 100755 (executable)
@@ -88,12 +88,16 @@ struct bin_info_t {
        char *path;
 };
 
+struct features_t {
+       uint64_t feature_0;
+       uint64_t feature_1;
+};
+
 struct bins_info_t {
        pthread_mutex_t bins_mutex;
        SLIST_HEAD(head, bin_info_t) bins_list;
 };
 
-
 typedef struct {
        __indexInfo index;
        __socketInfo socket;
@@ -102,7 +106,7 @@ typedef struct {
        int stateTouch;
        int init_complete;
        int custom_chart_callback_count;
-       uint64_t optionflag;
+       struct features_t features;
        struct bins_info_t bins_info;
 } __traceInfo;
 
@@ -123,7 +127,9 @@ char *real_abs_path(int fd, char *buffer, size_t bufsiz);
 void on_orientation_changed(int angle, bool capi);
 
 /* query functions */
-#define isOptionEnabled(OPT)   ((gTraceInfo.optionflag & OPT) != 0)
+#define isOptionEnabled(OPT0, OPT1)                            \
+       (((gTraceInfo.features.feature_0 & OPT0) != 0) ||       \
+        ((gTraceInfo.features.feature_1 & OPT1) != 0))
 
 /* Binaries list functions */
 int add_binary(char *path);
index cd2b729..83f765c 100755 (executable)
@@ -73,7 +73,7 @@ static int convert_angle(int angle)
 
 void on_orientation_changed(int angle, bool capi)
 {
-       if (isOptionEnabled(FL_USER_EVENT)) {
+       if (isOptionEnabled(FL_USER_EVENT, 0)) {
                inc_current_event_index();
 
                CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, 0, 0);
index 6bd8293..4bef206 100755 (executable)
@@ -67,7 +67,7 @@ GestureEventListener::~GestureEventListener()
 
 void GestureEventListener::OnCustomGestureCanceled (TouchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureCanceled__TouchGestureDetector__gestureDetector_,
@@ -78,7 +78,7 @@ void GestureEventListener::OnCustomGestureCanceled (TouchGestureDetector &gestur
 
 void GestureEventListener::OnCustomGestureChanged (TouchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureChanged__TouchGestureDetector__gestureDetector_,
@@ -89,7 +89,7 @@ void GestureEventListener::OnCustomGestureChanged (TouchGestureDetector &gesture
 
 void GestureEventListener::OnCustomGestureFinished (TouchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureFinished__TouchGestureDetector__gestureDetector_,
@@ -100,7 +100,7 @@ void GestureEventListener::OnCustomGestureFinished (TouchGestureDetector &gestur
 
 void GestureEventListener::OnCustomGestureStarted (TouchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureStarted__TouchGestureDetector__gestureDetector_,
@@ -111,7 +111,7 @@ void GestureEventListener::OnCustomGestureStarted (TouchGestureDetector &gesture
 
 void GestureEventListener::OnFlickGestureCanceled (TouchFlickGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -130,7 +130,7 @@ void GestureEventListener::OnFlickGestureCanceled (TouchFlickGestureDetector &ge
 
 void GestureEventListener::OnFlickGestureDetected (TouchFlickGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -149,7 +149,7 @@ void GestureEventListener::OnFlickGestureDetected (TouchFlickGestureDetector &ge
 
 void GestureEventListener::OnLongPressGestureCanceled (TouchLongPressGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -167,7 +167,7 @@ void GestureEventListener::OnLongPressGestureCanceled (TouchLongPressGestureDete
 
 void GestureEventListener::OnLongPressGestureDetected (TouchLongPressGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -185,7 +185,7 @@ void GestureEventListener::OnLongPressGestureDetected (TouchLongPressGestureDete
 
 void GestureEventListener::OnPanningGestureCanceled (TouchPanningGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -201,7 +201,7 @@ void GestureEventListener::OnPanningGestureCanceled (TouchPanningGestureDetector
 
 void GestureEventListener::OnPanningGestureChanged (TouchPanningGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -217,7 +217,7 @@ void GestureEventListener::OnPanningGestureChanged (TouchPanningGestureDetector
 
 void GestureEventListener::OnPanningGestureFinished (TouchPanningGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -233,7 +233,7 @@ void GestureEventListener::OnPanningGestureFinished (TouchPanningGestureDetector
 
 void GestureEventListener::OnPanningGestureStarted (TouchPanningGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -249,7 +249,7 @@ void GestureEventListener::OnPanningGestureStarted (TouchPanningGestureDetector
 
 void GestureEventListener::OnPinchGestureCanceled (TouchPinchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -267,7 +267,7 @@ void GestureEventListener::OnPinchGestureCanceled (TouchPinchGestureDetector &ge
 
 void GestureEventListener::OnPinchGestureChanged (TouchPinchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -285,7 +285,7 @@ void GestureEventListener::OnPinchGestureChanged (TouchPinchGestureDetector &ges
 
 void GestureEventListener::OnPinchGestureFinished (TouchPinchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -303,7 +303,7 @@ void GestureEventListener::OnPinchGestureFinished (TouchPinchGestureDetector &ge
 
 void GestureEventListener::OnPinchGestureStarted (TouchPinchGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -321,7 +321,7 @@ void GestureEventListener::OnPinchGestureStarted (TouchPinchGestureDetector &ges
 
 void GestureEventListener::OnRotationGestureCanceled (TouchRotationGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -339,7 +339,7 @@ void GestureEventListener::OnRotationGestureCanceled (TouchRotationGestureDetect
 
 void GestureEventListener::OnRotationGestureChanged (TouchRotationGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -357,7 +357,7 @@ void GestureEventListener::OnRotationGestureChanged (TouchRotationGestureDetecto
 
 void GestureEventListener::OnRotationGestureFinished (TouchRotationGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -375,7 +375,7 @@ void GestureEventListener::OnRotationGestureFinished (TouchRotationGestureDetect
 
 void GestureEventListener::OnRotationGestureStarted (TouchRotationGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -393,7 +393,7 @@ void GestureEventListener::OnRotationGestureStarted (TouchRotationGestureDetecto
 
 void GestureEventListener::OnTapGestureCanceled (TouchTapGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
@@ -412,7 +412,7 @@ void GestureEventListener::OnTapGestureCanceled (TouchTapGestureDetector &gestur
 
 void GestureEventListener::OnTapGestureDetected (TouchTapGestureDetector &gestureDetector)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                probeBlockStart();
                {
index 488ccc5..7f6a7ed 100755 (executable)
@@ -67,7 +67,7 @@ static Ecore_Event_Handler *ecore_event_evas_handlers[5];
 
 Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, void *event)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                if(event != NULL)
                {
@@ -86,7 +86,7 @@ Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, void *even
 
 Eina_Bool PROBE_NAME(ecore_event_evas_key_up)(void *data, int type, void *event)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                if(event != NULL)
                {
@@ -105,7 +105,7 @@ Eina_Bool PROBE_NAME(ecore_event_evas_key_up)(void *data, int type, void *event)
 
 Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_down)(void *data, int type, void *event)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                if(event != NULL)
                {
@@ -122,7 +122,7 @@ Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_down)(void *data, int type, v
 
 Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_up)(void *data, int type, void *event)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                if(event != NULL)
                {
@@ -139,7 +139,7 @@ Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_up)(void *data, int type, voi
 
 Eina_Bool PROBE_NAME(ecore_event_evas_mouse_move)(void *data, int type, void *event)
 {
-       if(isOptionEnabled(FL_USER_EVENT))
+       if(isOptionEnabled(FL_USER_EVENT, 0))
        {
                if(touch_pressed)
                {
index a62bbfc..991380e 100755 (executable)
@@ -816,7 +816,7 @@ static Eina_Bool _captureTimer(void __unused * data)
        if (gTraceInfo.screenshot.state == 2)
                gTraceInfo.screenshot.state = 1;
        pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex));
-       if (old == 2 && isOptionEnabled(FL_SCREENSHOT))
+       if (old == 2 && isOptionEnabled(FL_SCREENSHOT, 0))
                captureScreen();
 
        return ECORE_CALLBACK_CANCEL;
@@ -858,7 +858,7 @@ void screenshot_set(void)
                gTraceInfo.screenshot.state = 1;
        pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex));
 
-       if(old == 2 && isOptionEnabled(FL_SCREENSHOT))
+       if(old == 2 && isOptionEnabled(FL_SCREENSHOT, 0))
                captureScreen();
 }