From 6deeefd789286c56d4c4d0ca76d52d769d73e462 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Tue, 20 Sep 2016 22:46:54 +0900 Subject: [PATCH] Add direct attach gdb/valgrind feature Change-Id: I536815fdde1a823be2ddc62466798a2e92ea5493 Signed-off-by: Hyunho Kang --- widget_viewer_sdk/src/main.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/widget_viewer_sdk/src/main.c b/widget_viewer_sdk/src/main.c index 53249d0..735650c 100644 --- a/widget_viewer_sdk/src/main.c +++ b/widget_viewer_sdk/src/main.c @@ -30,7 +30,7 @@ #include #include #include - +#include #include #include #include @@ -51,6 +51,13 @@ int errno; #define VCONFKEY_WMS_CLOCKS_SET_IDLE "db/wms/clocks_set_idle" #endif +#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" + static struct info { int w; int h; @@ -668,6 +675,10 @@ static void _app_control(app_control_h service, void *data) pkgmgrinfo_appinfo_h app_info; app_control_h watch_control = NULL; bundle *b; + bundle *app_control_b; + char *sdk_util = NULL; + char *sdk_util_path = NULL; + char *sdk_util_arg = NULL; ret = app_control_get_extra_data(service, WIDGET_APPID, &widget_id); if (ret == APP_CONTROL_ERROR_NONE) { @@ -690,10 +701,35 @@ static void _app_control(app_control_h service, void *data) watch_manager_get_app_control(widget_id, &watch_control); app_control_to_bundle(watch_control, &b); + app_control_to_bundle(service, &app_control_b); + bundle_get_str(app_control_b, AUL_K_SDK, &sdk_util); + + if (sdk_util != NULL) { + if (strcmp(sdk_util, SDK_VALGRIND) == 0) { + bundle_get_str(app_control_b, DLP_K_VALGRIND_PATH, &sdk_util_path); + bundle_get_str(app_control_b, DLP_K_VALGRIND_ARG, &sdk_util_arg); + 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); + } else if (strcmp(sdk_util, SDK_DEBUG) == 0) { + bundle_get_str(app_control_b, DLP_K_GDBSERVER_PATH, &sdk_util_path); + bundle_get_str(app_control_b, DLP_K_DEBUG_ARG, &sdk_util_arg); + 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); + } + DbgPrint("util %s arg %s path %s", sdk_util, sdk_util_arg, sdk_util_path); + } appsvc_run_service(b, 0, NULL, NULL); DbgPrint("appsvc_run_service returns [%d]", widget_id); app_control_destroy(watch_control); } else { + app_control_to_bundle(service, &b); + widget_service_set_sdk_util(b); ret = unload_widget(); ret = prepare_widget(widget_id, service); -- 2.7.4