From 917cd0bef83f67c6b2b3c5eddf8197d44be47b7f Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 20 Sep 2016 22:48:29 +0900 Subject: Add direct attach gdb/valgrind feature Change-Id: Ib1f75b4dab29321058c66fb0c61a5237e1cd4159 Signed-off-by: Hyunho Kang --- include/widget_service_internal.h | 5 ++- src/widget_instance.c | 88 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/include/widget_service_internal.h b/include/widget_service_internal.h index ceca86c..98522e8 100644 --- a/include/widget_service_internal.h +++ b/include/widget_service_internal.h @@ -21,6 +21,8 @@ extern "C" { #endif +#include + /** * @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 } diff --git a/src/widget_instance.c b/src/widget_instance.c index 987abda..7ed1451 100644 --- a/src/widget_instance.c +++ b/src/widget_instance.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "widget_errno.h" @@ -38,6 +39,13 @@ #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; +} -- cgit v1.2.3