Added capability netcoredbg_support 34/182234/2 accepted/tizen/unified/20180625.141512 submit/tizen/20180622.064840
authorGourav Mittal <gourav.m@samsung.com>
Thu, 21 Jun 2018 12:00:30 +0000 (17:30 +0530)
committerGourav Mittal <gourav.m@samsung.com>
Thu, 21 Jun 2018 12:48:50 +0000 (18:18 +0530)
Change-Id: Ie72b3603e78cd1942c4be51663cf2382af842d47
Signed-off-by: Gourav Mittal <gourav.m@samsung.com>
src/sdb.c
src/sdb.h
src/services.c

index 7272099..df2b6ef 100644 (file)
--- a/src/sdb.c
+++ b/src/sdb.c
@@ -153,6 +153,29 @@ int is_appid2pid_supported(void) {
     return 0;
 }
 
+int is_netcoredbg_supported(void) {
+
+    FILE *fp = fopen(NETCOREDBG_LOCATION, "r");
+    if (fp) {
+        size_t len;
+        ssize_t num;
+        char *line = NULL;
+
+        while ((num = getline(&line, &len, fp)) != -1) {
+            if (strstr(line, "NETCOREDBG") != NULL) {
+                snprintf(g_capabilities.netcoredbg_support, sizeof(g_capabilities.netcoredbg_support),
+                         "%s", ENABLED);
+                free(line);
+                return 1;
+            }
+            free(line);
+            line = NULL;
+        }
+        fclose(fp);
+    }
+    return 0;
+}
+
 int is_container_enabled(void) {
     bool value;
     int ret;
@@ -1969,6 +1992,11 @@ static void init_capabilities(void) {
                 "%s", ENABLED);
     }
 
+    // netcore debugger support
+    ret = is_netcoredbg_supported();
+    snprintf(g_capabilities.netcoredbg_support, sizeof(g_capabilities.netcoredbg_support),
+             "%s", ret == 1 ? ENABLED : DISABLED);
+
     // Capability version
     snprintf(g_capabilities.sdbd_cap_version, sizeof(g_capabilities.sdbd_cap_version),
                 "%d.%d", SDBD_CAP_VERSION_MAJOR, SDBD_CAP_VERSION_MINOR);
index a603692..e96518d 100644 (file)
--- a/src/sdb.h
+++ b/src/sdb.h
@@ -259,6 +259,7 @@ typedef struct platform_info {
 
 #define ENABLED "enabled"
 #define DISABLED "disabled"
+#define NETCOREDBG_LOCATION "/usr/share/aul/dotnet.debugger"
 #define CAPBUF_SIZE 4096
 #define CAPBUF_ITEMSIZE 32
 #define CAPBUF_L_ITEMSIZE 256
@@ -291,6 +292,7 @@ typedef struct platform_capabilities
     char sdk_toolpath[CAPBUF_L_ITEMSIZE];       // sdk tool path
     char can_launch[CAPBUF_L_ITEMSIZE];         // target name
     char device_name[CAPBUF_ITEMSIZE];          // device name
+    char netcoredbg_support[CAPBUF_ITEMSIZE];   // enabled or disabled
 
     char platform_version[CAPBUF_ITEMSIZE];     // platform version (ex. 2.3.0)
     char product_version[CAPBUF_ITEMSIZE];      // product version (ex. 1.0)
index 064ccf6..b71d7a9 100644 (file)
@@ -1104,6 +1104,10 @@ static void get_capability(int fd, void *cookie) {
     offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE,
             "pkgcmd_debugmode", g_capabilities.pkgcmd_debugmode);
 
+    // pkgcmd debug mode support
+    offset += put_key_value_string(cap_buffer, offset, CAPBUF_SIZE,
+            "netcoredbg_support", g_capabilities.netcoredbg_support);
+
     offset++; // for '\0' character
 
     writex(fd, &offset, sizeof(uint16_t));