Add direct attach gdb/valgrind feature 88/88788/6 accepted/tizen/common/20161010.150103 accepted/tizen/ivi/20161011.050309 accepted/tizen/mobile/20161011.050222 accepted/tizen/tv/20161011.050239 accepted/tizen/wearable/20161011.050255 submit/tizen/20161010.123514
authorHyunho Kang <hhstark.kang@samsung.com>
Tue, 20 Sep 2016 13:48:29 +0000 (22:48 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Mon, 10 Oct 2016 11:47:35 +0000 (20:47 +0900)
Change-Id: Ib1f75b4dab29321058c66fb0c61a5237e1cd4159
Signed-off-by: Hyunho Kang <hhstark.kang@samsung.com>
include/widget_service_internal.h
src/widget_instance.c

index ceca86c..98522e8 100644 (file)
@@ -21,6 +21,8 @@
 extern "C" {
 #endif
 
+#include <bundle.h>
+
 /**
  * @internal
  * @brief Index of buffer
@@ -62,7 +64,6 @@ extern "C" {
 #define WIDGET_EVENT_WIDGET_EXTRA_BUFFER_DESTROYED 24 /**< WIDGET Extra Buffer destroyed event */
 #define WIDGET_EVENT_GBAR_EXTRA_BUFFER_DESTROYED 25 /**< WIDGET Extra Buffer destroyed event */
 
-
 /**
  * @internal
  * @brief specify the source of input event
@@ -762,8 +763,8 @@ extern int widget_service_get_widget_max_count(const char *widget_id);
  * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
  */
 extern int widget_service_get_auto_align(const char *widget_id);
-
 extern int widget_service_get_hw_accelerated(const char *widget_id);
+extern int widget_service_set_sdk_util(bundle *data);
 
 #ifdef __cplusplus
 }
index 987abda..7ed1451 100644 (file)
@@ -30,6 +30,7 @@
 #include <aul_svc.h>
 #include <aul_app_com.h>
 #include <widget_service.h>
+#include <widget_service_internal.h>
 #include <app.h>
 #include "widget_errno.h"
 
 #define WIDGET_CLASS_DELIMITER "@"
 #define QUERY_MAX_LEN 8192
 
+#define DLP_K_DEBUG_ARG "__DLP_DEBUG_ARG__"
+#define DLP_K_GDBSERVER_PATH "__DLP_GDBSERVER_PATH__"
+#define DLP_K_VALGRIND_ARG "__DLP_VALGRIND_ARG__"
+#define DLP_K_VALGRIND_PATH "__DLP_VALGRIND_PATH__"
+#define SDK_DEBUG "DEBUG"
+#define SDK_VALGRIND "VALGRIND"
+
 #ifndef TIZEN_PATH_MAX
 #define TIZEN_PATH_MAX 1024
 #endif
@@ -81,6 +89,11 @@ static aul_app_com_connection_h conn_status;
 static GHashTable *lifecycle_tbl;
 static int is_status_handler_connected;
 
+static char *sdk_util = NULL;
+static char *sdk_util_path = NULL;
+static char *sdk_util_arg = NULL;
+static char *sdk_caller_pid = NULL;
+
 static char *package_id;
 
 struct lifecycle_local_s {
@@ -383,6 +396,7 @@ EAPI int widget_instance_launch(const char *instance_id, char *content_info, int
        bundle *b;
        widget_instance_h instance;
 
+
        _D("launch: %s", instance_id);
 
        if (instance_id == NULL) {
@@ -425,6 +439,24 @@ EAPI int widget_instance_launch(const char *instance_id, char *content_info, int
        bundle_add_str(b, AUL_K_WAYLAND_DISPLAY, wayland_display);
        bundle_add_str(b, AUL_K_WAYLAND_WORKING_DIR, xdg_runtime_dir);
        bundle_add_str(b, WIDGET_K_OPERATION, "create");
+
+       if (sdk_util != NULL) {
+               bundle_add_str(b, AUL_K_ORG_CALLER_PID, sdk_caller_pid);
+               if (strcmp(sdk_util, SDK_DEBUG) == 0) {
+                       bundle_add_str(b, AUL_K_SDK, SDK_DEBUG);
+                       if (sdk_util_path)
+                               bundle_add_str(b, DLP_K_GDBSERVER_PATH, sdk_util_path);
+                       if (sdk_util_arg)
+                               bundle_add_str(b, DLP_K_DEBUG_ARG, sdk_util_arg);
+               } else if (strcmp(sdk_util, SDK_VALGRIND) == 0) {
+                       bundle_add_str(b, AUL_K_SDK, SDK_VALGRIND);
+                       if (sdk_util_path)
+                               bundle_add_str(b, DLP_K_VALGRIND_PATH, sdk_util_path);
+                       if (sdk_util_arg)
+                               bundle_add_str(b, DLP_K_VALGRIND_ARG, sdk_util_arg);
+               }
+       }
+
        if (content_info) {
                bundle_add_str(b, WIDGET_K_CONTENT_INFO, content_info);
                instance->content_info = strdup(content_info);
@@ -1144,3 +1176,59 @@ EAPI int widget_instance_unlisten_status(const char *widget_id)
 
        return 0;
 }
+
+EAPI int widget_service_set_sdk_util(bundle *data)
+{
+       char *util = NULL;
+       char *util_path = NULL;
+       char *util_arg = NULL;
+       char *caller_pid = NULL;
+
+       if (sdk_util) {
+               free(sdk_util);
+               sdk_util = NULL;
+       }
+
+       if (sdk_util_path) {
+               free(sdk_util_path);
+               sdk_util_path = NULL;
+       }
+
+       if (sdk_util_arg) {
+               free(sdk_util_arg);
+               sdk_util_arg = NULL;
+       }
+
+       if (sdk_caller_pid) {
+               free(sdk_caller_pid);
+               sdk_caller_pid = NULL;
+       }
+
+       bundle_get_str(data, AUL_K_SDK, &util);
+       bundle_get_str(data, AUL_K_ORG_CALLER_PID, &caller_pid);
+       if (caller_pid == NULL)
+               bundle_get_str(data, AUL_K_CALLER_PID, &caller_pid);
+
+       if (util) {
+               sdk_util = strdup(util);
+
+               if (strcmp(util, SDK_DEBUG) == 0) {
+                       bundle_get_str(data, DLP_K_GDBSERVER_PATH, &util_path);
+                       bundle_get_str(data, DLP_K_DEBUG_ARG, &util_arg);
+               } else if (strcmp(util, SDK_VALGRIND) == 0) {
+                       bundle_get_str(data, DLP_K_VALGRIND_PATH, &util_path);
+                       bundle_get_str(data, DLP_K_VALGRIND_ARG, &util_arg);
+               }
+
+               if (util_path)
+                       sdk_util_path = strdup(util_path);
+
+               if (util_arg)
+                       sdk_util_arg = strdup(util_arg);
+
+               if (caller_pid)
+                       sdk_caller_pid = strdup(caller_pid);
+       }
+
+       return 0;
+}