tizen 2.4 release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20151029.041924 submit/tizen_2.4/20151028.062447 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 06:31:19 +0000 (15:31 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 06:31:19 +0000 (15:31 +0900)
41 files changed:
bin/xevlog_analyze/xevlog_analyze.c [changed mode: 0755->0644]
common/Makefile.am
common/ds/bintree.c [changed mode: 0755->0644]
common/ds/bool_exp_parser.c [changed mode: 0755->0644]
common/xdbg_dbus_client.c
common/xdbg_dbus_server.c
common/xdbg_evlog.c
common/xdbg_evlog.h
common/xdbg_evlog_core.c
common/xdbg_evlog_dri2.c
common/xdbg_evlog_dri3.c [new file with mode: 0644]
common/xdbg_evlog_dri3.h [new file with mode: 0644]
common/xdbg_evlog_gesture.c
common/xdbg_evlog_hwc.c [changed mode: 0755->0644]
common/xdbg_evlog_hwc.h [changed mode: 0755->0644]
common/xdbg_evlog_present.c [new file with mode: 0644]
common/xdbg_evlog_present.h [new file with mode: 0644]
common/xdbg_types.h
configure.ac
lib/xdbg.pc.in
lib/xdbg_dump.c
lib/xdbg_log.c [changed mode: 0755->0644]
lib/xdbg_log.h
lib/xdbg_log_drmevent.c [changed mode: 0755->0644]
lib/xdbg_log_fpsdebug.c [changed mode: 0755->0644]
lib/xdbg_log_plist.c [changed mode: 0755->0644]
lib/xdbg_log_plist.h
lib/xdbg_log_secure.h.in
module/Makefile.am
module/xdbg.conf [new file with mode: 0644]
module/xdbg_module.c
module/xdbg_module.h
module/xdbg_module_clist.c
module/xdbg_module_clist.h
module/xdbg_module_command.c [changed mode: 0755->0644]
module/xdbg_module_evlog.c
module/xdbg_module_evlog.h
module/xdbg_module_main.c
module/xdbg_module_options.c
packaging/xorg-x11-module-xdbg.spec
xorg-x11-module-xdbg.manifest

old mode 100755 (executable)
new mode 100644 (file)
index d27ff39..a17f17a
@@ -85,11 +85,11 @@ _printUsage(char* name)
     printf("\n");
     printf("              [RULE] : C Language-style boolean expression syntax. [VARIABLE] [COMPAROTOR] [VALUE]\n");
     printf("              [VARIABLE] : type / major / minor / command / cmd / pid\n");
-    printf("              [COMPARATOR] : & / && / and / | / || / or / = / == / != / > / >= / < / <=\n");
+    printf("              [COMPARATOR] : & / && / | / || / = / == / != / > / >= / < / <=\n");
     printf("              [VALUE] : string / number  \n");
     printf("\n");
     printf("           ie)\n");
-    printf("               xevlog_analyze -a \"(type=request) && (major == X11 and (minor = SendEvent or minor = ReceiveEvent))\"\n");
+    printf("               xevlog_analyze -a \"(type=request) && (major == X11 && (minor = SendEvent || minor = ReceiveEvent))\"\n");
     printf("               xevlog_analyze -n cmd!=ls\n");
     printf("\n");
     printf("           * WARNING : If you set both -a and -n option, must set -a option first. Otherwise Logs you DO NOT want can be printed.\n");
@@ -123,7 +123,11 @@ static void _xEvlogAnalyzePrint (EvlogOption *eo, char* reply, int* len)
     fd = open (eo->path_name, O_RDONLY);
     if (fd < 0)
     {
-        printf ("failed: open '%s'. (%s)\n", eo->path_name, strerror(errno));
+        char err_buf[256] = {0,};
+        char *errp;
+
+        errp = (char *)strerror_r (errno, err_buf, sizeof(err_buf));
+        printf ("failed: open '%s'. (%s)\n", eo->path_name, errp);
         return;
     }
 
@@ -132,7 +136,11 @@ static void _xEvlogAnalyzePrint (EvlogOption *eo, char* reply, int* len)
 
     if (cfd < 0)
     {
-        printf ("failed: open consol '%s'. (%s)\n", fd_name, strerror(errno));
+        char err_buf[256] = {0,};
+        char *errp;
+
+        errp = (char *)strerror_r (errno, err_buf, sizeof(err_buf));
+        printf ("failed: open consol '%s'. (%s)\n", fd_name, errp);
         goto print_done;
     }
 
@@ -516,7 +524,7 @@ int main(int argc, char** argv)
     if (!new_argv)
     {
         printf ("failed: malloc new argv\n");
-        exit (-1);
+        return 0;
     }
 
     snprintf (temp, sizeof(temp), "%d", (int)getpid());
index 3af3469..84ef4b1 100644 (file)
@@ -29,6 +29,8 @@ COMMON_SOURCE =  \
     xdbg_evlog_core.c \
     xdbg_evlog_composite.c \
     xdbg_evlog_dri2.c \
+    xdbg_evlog_dri3.c \
+    xdbg_evlog_present.c \
     xdbg_evlog_damage.c \
     xdbg_evlog_gesture.c \
     xdbg_evlog_xext.c \
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 2f2550a..7ea9cf5 100644 (file)
@@ -172,12 +172,20 @@ XDbgDBusClientInfo*
 xDbgDBusClientConnect (void)
 {
     XDbgDBusClientInfo *info = NULL;
+    char *display_num = NULL;
 
     info = calloc (1, sizeof (XDbgDBusClientInfo));
     GOTO_IF_FAIL (info != NULL, err_conn);
 
+
+    if(!(display_num = getenv("DISPLAY")))
+    {
+        XDBG_LOG ("[CLIENT] failed: get DISPLAY ENV\n");
+        goto err_conn;
+    }
+
     snprintf (info->client, STR_LEN, "%d", getpid());
-    snprintf (info->reqname, STR_LEN, "%s%d", XDBG_DBUS_CLIENT, getpid());
+    snprintf (info->reqname, STR_LEN, "%s%d", XDBG_DBUS_CLIENT, atoi(display_num));
 
     if (!_xDbgDBusClinetInit (info))
         goto err_conn;
index 3b3180c..74b0766 100644 (file)
@@ -39,6 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <dbus/dbus.h>
 #include <os.h>
 #include <dix.h>
+#include <fcntl.h>
 
 #include "xdbg.h"
 #include "xdbg_types.h"
@@ -70,6 +71,127 @@ static CARD32 _xDbgDBusServerTimeout (OsTimerPtr timer, CARD32 time, pointer arg
 static Bool _xDbgDBusServerInit (XDbgDBusServerInfo *info);
 static void _xDbgDBusServerDeinit (XDbgDBusServerInfo *info);
 
+static uint32_t
+_xdbgDBusServerGetClientPID(DBusConnection *conn, char *client_name)
+{
+    DBusMessage *msg = NULL;
+    DBusMessage *reply_msg = NULL;
+    DBusMessageIter iter;
+    DBusError err;
+    uint32_t pid = 0;
+
+    RETURN_VAL_IF_FAIL (client_name != NULL, 0);
+
+    dbus_error_init (&err);
+
+    msg = dbus_message_new_method_call ("org.freedesktop.DBus", "/org/freedesktop/DBus",
+                                        "org.freedesktop.DBus", "GetConnectionUnixProcessID");
+
+    GOTO_IF_FAIL (msg != NULL, err_send);
+
+    dbus_message_iter_init_append (msg, &iter);
+
+    if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &client_name))
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] failed: append\n");
+        goto err_send;
+    }
+
+    reply_msg = dbus_connection_send_with_reply_and_block (conn, msg,
+                                                           1000, &err);
+
+    if (dbus_error_is_set (&err))
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] failed: send (%s)\n",  err.message);
+        goto err_send;
+    }
+    GOTO_IF_FAIL (reply_msg != NULL, err_send);
+
+    if (!dbus_message_iter_init (reply_msg, &iter))
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] Message has no arguments\n");
+        goto err_send;
+    }
+
+    if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_UINT32)
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] Argument is not unint32!\n");
+        goto err_send;
+    }
+
+    dbus_message_iter_get_basic (&iter, &pid);
+    if (!pid)
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] pid is 0\n");
+        goto err_send;
+    }
+
+    XDBG_DEBUG (MDBUS, "[SERVER] Get Client name:%s pid:%u\n", client_name, pid);
+
+    return pid;
+
+err_send:
+    if (msg)
+        dbus_message_unref(msg);
+    if (reply_msg)
+        dbus_message_unref(reply_msg);
+
+    return 0;
+}
+
+
+static Bool
+_xDbgDBusServerCheckSmackLabel (DBusConnection *connection)
+{
+    char xdbg_client_name[STR_LEN];
+    char label_path[STR_LEN];
+    char label[STR_LEN];
+    uint32_t pid = 0;
+    int fd = -1;
+    int i;
+
+    snprintf(xdbg_client_name, sizeof(xdbg_client_name), "org.x.dbg.client%d", atoi(display));
+
+    pid = _xdbgDBusServerGetClientPID (connection, xdbg_client_name);
+    if (!pid)
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] failed: Get client PID\n");
+       return FALSE;
+    }
+
+    snprintf(label_path, sizeof(label_path), "/proc/%u/attr/current", pid);
+
+    fd = open(label_path, O_RDONLY);
+    if (fd < 0)
+    {
+
+        XDBG_ERROR (MDBUS, "[SERVER] Failed: Open client smack label path\n");
+       return FALSE;
+    }
+
+    i = read(fd, label, sizeof(label));
+    close(fd);
+
+    if (i < 0)
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] Failed: Read client smack label\n");
+       return FALSE;
+    }
+
+    if (i < STR_LEN)
+        label[i] = '\0';
+
+    if (strcmp(label, "xorg"))
+    {
+        XDBG_ERROR (MDBUS, "[SERVER] Deny  smack label:%s\n", label);
+        return FALSE;
+    }
+
+    XDBG_DEBUG (MDBUS, "[SERVER] Get client  smack label:%s\n", label);
+
+    return TRUE;
+}
+
 static Bool
 _xDbgDBusServerReplyMessage (XDbgDBusServerInfo *info, DBusMessage *msg, char *reply)
 {
@@ -228,6 +350,9 @@ _xDbgDBusServerMsgHandler (DBusConnection *connection, DBusMessage *msg, void *d
     XDBG_DEBUG (MDBUS, "[SERVER] Got a message (%s.%s)\n",
                dbus_message_get_interface (msg), dbus_message_get_member (msg));
 
+    if (!_xDbgDBusServerCheckSmackLabel(connection))
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
     if (!dbus_message_is_method_call (msg, XDBG_DBUS_INTERFACE, XDBG_DBUS_METHOD))
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
index 9da588c..57f9427 100644 (file)
@@ -54,8 +54,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dix.h"
 #endif
 
-static char *evt_type[] = { "Event", "Request", "Reply", "Flush", "Error" };
-static char *evt_dir[]  = { "<====", "---->",   "<----", "*****", "<----"};
+static char *evt_type[] = { "Event", "Request", "Reply", "Flush", "Error" ""};
+static char *evt_dir[]  = { "<====", "---->",   "<----", "*****", "<----", ""};
 
 static RULE_CHECKER rc = NULL;
 
@@ -285,6 +285,8 @@ xDbgEvlogRuleValidate (EvlogInfo *evinfo)
         evlog_name = evinfo->evt.name;
     else if (evinfo ->type == REPLY)
         evlog_name = evinfo->rep.name;
+    else if (evinfo ->type == XERROR)
+        return TRUE;
 
     return rulechecker_validate_rule (rc,
                                       evinfo->type,
@@ -305,7 +307,11 @@ xDbgEvlogReadRuleFile(const char *filename, char *reply, int *len)
     fd = open (filename, O_RDONLY);
     if (fd < 0)
     {
-        REPLY ("failed: open '%s'. (%s)\n", filename, strerror(errno));
+        char err_buf[256] = {0,};
+        char *errp;
+
+        errp = (char *)strerror_r (errno, err_buf, sizeof(err_buf));
+        REPLY ("failed: open '%s'. (%s)\n", filename, errp);
         return FALSE;
     }
 
@@ -368,6 +374,8 @@ ExtensionInfo Evlog_extensions[] = {
     {xDbgEvlogXextXtestExt1GetBase, 0, 0, 0, NULL, NULL},
     {xDbgEvlogXextShapeGetBase, 0, 0, 0, NULL, NULL},
     {xDbgEvlogXvGetBase, 0, 0, 0, NULL, NULL},
+    {xDbgEvlogDri3GetBase, 0, 0, 0, NULL, NULL},
+    {xDbgEvlogPresentGetBase, 0, 0, 0, NULL, NULL},
 #if HAVE_HWC
     {xDbgEvlogHwcGetBase, 0, 0, 0, NULL, NULL},
 #endif
@@ -487,13 +495,15 @@ xDbgEvlogFillLog (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
         reply = xDbgEvlogReply (evinfo, detail_level, reply, len);
         REPLY (")");
     }
-    else if (evinfo->type == ERROR)
+    else if (evinfo->type == ERROR || evinfo->type == XERROR)
     {
-        REPLY("(ErrorCode(0x%02x) resourceID(0x%x) majorCode(%d) minorCode(%d))",
+        REPLY("(%s:ErrorCode(0x%02x) %s:majorCode(%d) minorCode(%d) resourceID(0x%x))",
+            evinfo->err.errorName,
             evinfo->err.errorCode,
-            (unsigned int)evinfo->err.resourceID,
+            evinfo->err.majorName,
             evinfo->err.majorCode,
-            evinfo->err.minorCode);
+            evinfo->err.minorCode,
+            (unsigned int)evinfo->err.resourceID);
     }
     else
     {
index 70a2742..2141ee4 100644 (file)
@@ -48,6 +48,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xdbg_evlog_randr.h"
 #include "xdbg_evlog_xinput.h"
 #include "xdbg_evlog_xv.h"
+#include "xdbg_evlog_dri3.h"
+#include "xdbg_evlog_present.h"
 #if HAVE_HWC
 #include "xdbg_evlog_hwc.h"
 #endif
index 6c5934a..92f7ffc 100755 (executable)
@@ -58,6 +58,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xdbg_evlog_core.h"
 #include "xdbg_evlog.h"
 
+#define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
 
 static char*
 _getWindowAttributeMask (CARD32 mask, char *reply, int *len)
@@ -130,7 +131,7 @@ _getConfigureWindowMask (CARD16 mask, char *reply, int *len, XID *vlist)
     if(vlist)
     {
         pVlist = vlist;
-        
+
         if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) {
             GET_INT16(CWX, x);
             GET_INT16(CWY, y);
@@ -143,7 +144,7 @@ _getConfigureWindowMask (CARD16 mask, char *reply, int *len, XID *vlist)
             GET_CARD16(CWHeight, h);
         }
     }
-    
+
     for (i = 0 ; i < sizeof(mask) * 4 ; i++)
     {
         if(mask & (1 << i))
@@ -338,7 +339,7 @@ char * xDbgEvlogRequestCore (EvlogInfo *evinfo, int detail_level, char *reply, i
     \r           REPLY ("(");
                 reply = _getWindowAttributeMask(stuff->valueMask, reply, len);
                 if (stuff->valueMask == CWEventMask)
-        
+
            REPLY (", mask(%x)", (unsigned int)*((XID *)&stuff[1]));
     \r           REPLY (")");
             }
@@ -426,7 +427,21 @@ char * xDbgEvlogRequestCore (EvlogInfo *evinfo, int detail_level, char *reply, i
 
             return reply;
         }
+    case X_InternAtom:
+        {
+            xInternAtomReq *stuff = (xInternAtomReq *)req;
+            char temp[64] = {0, };
+
+            int min = MIN (sizeof (temp) -1, stuff->nbytes);
+            strncpy (temp, (char*)&stuff[1], min);
+            temp[min] = '\0';
+
+            REPLY (": Atom(%s) onlyIfExists(%s)",
+                temp,
+                stuff->onlyIfExists?"True":"False");
 
+            return reply;
+        }
     case X_ChangeProperty:
         {
             xChangePropertyReq *stuff = (xChangePropertyReq *)req;
@@ -1745,10 +1760,205 @@ char * xDbgEvlogEventCore (EvlogInfo *evinfo, int detail_level, char *reply, int
             return reply;
                }
 
-    case MappingNotify:
     case GenericEvent:
+        {
+            int xinput_event = 0;
+            xGenericEvent *ge = (xGenericEvent *)evt;
+            switch (ge->evtype)
+            {
+                case PresentConfigureNotify:
+                {
+                    xPresentConfigureNotify *stuff = (xPresentConfigureNotify *) evt;
+
+                    REPLY (":PresentConfigureNotify window(0x%x)(%ux%u+%d+%d) off x,y (%d,%d)  pximap width(%u) height(%u) flags(0x%x)",
+                        (unsigned int)stuff->window,
+                        (unsigned int)stuff->width,
+                        (unsigned int)stuff->height,
+                        (int)stuff->x,
+                        (int)stuff->y,
+                        (int)stuff->off_x,
+                        (int)stuff->off_y,
+                        (unsigned int)stuff->pixmap_width,
+                        (unsigned int)stuff->pixmap_height,
+                        (unsigned int)stuff->pixmap_flags);
+
+                    evinfo->evt.size = sizeof (xPresentConfigureNotify);
+
+                    return reply;
+                }
+
+                case PresentCompleteNotify:
+                {
+                    xPresentCompleteNotify *stuff = (xPresentCompleteNotify *) evt;
+                    REPLY (":PresentCompleteNotify window(0x%x) serial(0x%x) kind(%u) mode(%u) ust(%lu)",
+                        (unsigned int)stuff->window,
+                        (unsigned int)stuff->serial,
+                        (unsigned int)stuff->kind,
+                        (unsigned int)stuff->mode,
+                        (unsigned long)stuff->ust);
+
+                    evinfo->evt.size = sizeof (xPresentCompleteNotify);
+
+                    return reply;
+                }
+
+                case PresentIdleNotify:
+                {
+                    xPresentIdleNotify *stuff = (xPresentIdleNotify *) evt;
+                    REPLY (":PresentIdleNotify window(0x%x) serial(0x%x) pixmap(0x%x) idle_fence(0x%x)",
+                        (unsigned int)stuff->window,
+                        (unsigned int)stuff->serial,
+                        (unsigned int)stuff->pixmap,
+                        (unsigned int)stuff->idle_fence);
+
+                    evinfo->evt.size = sizeof (xPresentIdleNotify);
+
+                    return reply;
+                }
+
+                case PresentRedirectNotify:
+                {
+                    xPresentRedirectNotify *stuff = (xPresentRedirectNotify *)evt;
+
+                    REPLY (":PresentRedirectNotify window(0x%x) pixmap(0x%x)",
+                        (unsigned int)stuff->window,
+                        (unsigned int)stuff->pixmap);
+
+#if 0
+                    REPLY (": window(0x%x) pixmap(0x%x) (s,v,u)(%u,0x%x,0x%x) x,y(%d,%d) crtc(%u) wait(0x%x) idle(0x%x) op(0x%x) (t,d,r)(%u,%u,%u)",
+
+                        (unsigned int)stuff->serial,
+                        (unsigned int)stuff->valid,
+                        (unsigned int)stuff->update,
+                        (int)stuff->x_off,
+                        (int)stuff->y_off,
+                        (unsigned int)stuff->target_crtc,
+                        (unsigned int)stuff->wait_fence,
+                        (unsigned int)stuff->idle_fence,
+                        (unsigned int)stuff->options,
+                        (unsigned int)stuff->target_msc,
+                        (unsigned int)stuff->divisor,
+                        (unsigned int)stuff->remainder);
+#endif
+                    evinfo->evt.size = sizeof (xPresentRedirectNotify);
+
+                    return reply;
+                }
+
+                /* XI generic evnet */
+                case XI_ButtonPress:
+                {
+                    REPLY (":XI_ButtonPress");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_ButtonRelease:
+                {
+                    REPLY (":XI_ButtonRelease");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_Motion:
+                {
+                    REPLY (":XI_Motion");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_TouchBegin:
+                {
+                    REPLY (":XI_TouchBegin");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_TouchEnd:
+                {
+                    REPLY (":XI_TouchEnd");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_TouchUpdate:
+                {
+                    REPLY (":XI_TouchUpdate");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_TouchOwnership:
+                {
+                    REPLY (":XI_TouchOwnership");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_TouchCancel:
+                {
+                    REPLY (":XI_TouchCancel");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_RawButtonPress:
+                {
+                    REPLY (":XI_RawButtonPress");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_RawButtonRelease:
+                {
+                    REPLY (":XI_RawButtonRelease");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_RawMotion:
+                {
+                    REPLY (":XI_RawMotion");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_RawTouchBegin:
+                {
+                    REPLY (":XI_RawTouchBegin");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_RawTouchEnd:
+                {
+                    REPLY (":XI_RawTouchEnd");
+                    xinput_event = 1;
+                    break;
+                }
+                case XI_RawTouchUpdate:
+                {
+                    REPLY (":XI_RawTouchUpdate");
+                    xinput_event = 1;
+                    break;
+                }
+
+                default:
+                {
+                    break;
+                }
+
+            }
+
+            if (xinput_event == 1)
+            {
+                xXIDeviceEvent *stuff = (xXIDeviceEvent *) evt;
+                REPLY (" device(%d), event win(0x%x), child(0x%x), root(%.f,%.f), win(%.f, %.f)\n",
+                    stuff->deviceid,
+                    stuff->event,
+                    stuff->child,
+                    FP1616toDBL(stuff->root_x),
+                    FP1616toDBL(stuff->root_y),
+                    FP1616toDBL(stuff->event_x),
+                    FP1616toDBL(stuff->event_y));
+
+                evinfo->evt.size = sizeof (xXIDeviceEvent);
+
+                return reply;
+            }
+        }
+    case MappingNotify:
     default:
             break;
+
     }
 
     return reply;
@@ -1812,6 +2022,23 @@ char * xDbgEvlogReplyCore (EvlogInfo *evinfo, int detail_level, char *reply, int
             return reply;
         }
 
+    case X_InternAtom:
+        {
+            if (evinfo->rep.isStart)
+            {
+                xInternAtomReply *stuff = (xInternAtomReply *)rep;
+
+                REPLY (": Atom(0x%x)",
+                    (unsigned int)stuff->atom);
+            }
+            else
+            {
+                return reply;
+            }
+
+            return reply;
+        }
+
     case X_GetProperty:
         {
             if (evinfo->rep.isStart)
@@ -1923,4 +2150,4 @@ char * xDbgEvlogReplyCore (EvlogInfo *evinfo, int detail_level, char *reply, int
     }
 
     return reply;
-}
\ No newline at end of file
+}
index 533a18f..183dec5 100644 (file)
@@ -195,8 +195,9 @@ _EvlogEventDri2 (EvlogInfo *evinfo, int first_base, int detail_level, char *repl
     case DRI2_BufferSwapComplete:
         {
             xDRI2BufferSwapComplete *stuff = (xDRI2BufferSwapComplete *) evt;
-            REPLY (": XID(0x%x) ust(0x%x/0x%x) msc(0x%x/0x%x) sbc(0x%x/0x%x)",
+            REPLY (": XID(0x%x) type:%d ust(0x%x/0x%x) msc(0x%x/0x%x) sbc(0x%x/0x%x)",
                 (unsigned int)stuff->drawable,
+                (int)stuff->event_type,
                 (unsigned int)stuff->ust_hi,
                 (unsigned int)stuff->ust_lo,
                 (unsigned int)stuff->msc_hi,
diff --git a/common/xdbg_evlog_dri3.c b/common/xdbg_evlog_dri3.c
new file mode 100644 (file)
index 0000000..6aeada6
--- /dev/null
@@ -0,0 +1,211 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <X11/extensions/dri3proto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_dri3.h"
+#include "xdbg_evlog.h"
+
+static char *
+_EvlogRequestDri3 (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
+{
+    xReq *req = evinfo->req.ptr;
+
+    switch (req->data)
+    {
+    case X_DRI3PixmapFromBuffer:
+        {
+            xDRI3PixmapFromBufferReq *stuff = (xDRI3PixmapFromBufferReq *)req;
+            REPLY (": Pixmap(0x%x) drawable(0x%x) size(%u) width(%u) height(%u) stride(%u) depth(%u) bpp(%u)",
+                (unsigned int)stuff->pixmap,
+                (unsigned int)stuff->drawable,
+                (unsigned int)stuff->size,
+                (unsigned int)stuff->width,
+                (unsigned int)stuff->height,
+                (unsigned int)stuff->stride,
+                (unsigned int)stuff->depth,
+                (unsigned int)stuff->bpp);
+
+            return reply;
+        }
+
+    case X_DRI3BufferFromPixmap:
+        {
+            xDRI3BufferFromPixmapReq *stuff = (xDRI3BufferFromPixmapReq *)req;
+            REPLY (": Pixmap(0x%x)",
+                (unsigned int)stuff->pixmap);
+
+            return reply;
+        }
+
+    case X_DRI3FenceFromFD:
+        {
+            xDRI3FenceFromFDReq *stuff = (xDRI3FenceFromFDReq *)req;
+            REPLY (": drawable(0x%x) fence(0x%x) initially_triggered(%s)",
+                (unsigned int)stuff->drawable,
+                (unsigned int)stuff->fence,
+                stuff->initially_triggered?"True":"False");
+
+            return reply;
+        }
+
+    case X_DRI3FDFromFence:
+        {
+            xDRI3FDFromFenceReq *stuff = (xDRI3FDFromFenceReq *)req;
+            REPLY (": drawable(0x%x) fence(0x%x)",
+                (unsigned int)stuff->drawable,
+                (unsigned int)stuff->fence);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventDri3 (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
+{
+    xEvent *evt = evinfo->evt.ptr;
+
+    switch ((evt->u.u.type & 0x7F) - first_base)
+    {
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogReplyDri3 (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
+{
+    xGenericReply *rep = evinfo->rep.ptr;
+
+    switch (evinfo->rep.reqData)
+    {
+    case X_DRI3BufferFromPixmap:
+        {
+            if (evinfo->rep.isStart)
+            {
+                xDRI3BufferFromPixmapReply *stuff = (xDRI3BufferFromPixmapReply *)rep;
+                REPLY (": nfd(%u) sequenceNumber(%u) size(%u) width(%u) height(%u) stride(%u) depth(%u) bpp(%u)",
+                    (unsigned int)stuff->nfd,
+                    (unsigned int)stuff->sequenceNumber,
+                    (unsigned int)stuff->size,
+                    (unsigned int)stuff->width,
+                    (unsigned int)stuff->height,
+                    (unsigned int)stuff->stride,
+                    (unsigned int)stuff->depth,
+                    (unsigned int)stuff->bpp);
+            }
+            else
+            {
+                return reply;
+            }
+
+            return reply;
+        }
+
+    case X_DRI3FDFromFence:
+        {
+            if (evinfo->rep.isStart)
+            {
+                xDRI3FDFromFenceReply *stuff = (xDRI3FDFromFenceReply *)rep;
+                REPLY (": nfd(%u) sequenceNumber(%u)",
+                    (unsigned int)stuff->nfd,
+                    (unsigned int)stuff->sequenceNumber);
+            }
+            else
+            {
+                return reply;
+            }
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+void
+xDbgEvlogDri3GetBase (ExtensionInfo *extinfo)
+{
+#ifdef XDBG_CLIENT
+    RETURN_IF_FAIL (extinfo != NULL);
+
+    extinfo->req_func = _EvlogRequestDri3;
+    extinfo->evt_func = _EvlogEventDri3;
+    extinfo->rep_func = _EvlogReplyDri3;
+#else
+    ExtensionEntry *xext = CheckExtension (DRI3_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+    RETURN_IF_FAIL (extinfo != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestDri3;
+    extinfo->evt_func = _EvlogEventDri3;
+    extinfo->rep_func = _EvlogReplyDri3;
+#endif
+}
diff --git a/common/xdbg_evlog_dri3.h b/common/xdbg_evlog_dri3.h
new file mode 100644 (file)
index 0000000..9640c4e
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_DRI3_H__
+#define __XDBG_EVLOG_DRI3_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogDri3GetBase (ExtensionInfo *extinfo);
+
+#endif
index 74c87e3..6d50fcf 100644 (file)
@@ -110,7 +110,7 @@ _EvlogRequestGesture(EvlogInfo *evinfo, int detail_level, char *reply, int *len)
                     case GestureNotifyTapNHold:  event_type = "GestureNotifyTapNHold"; break;
                     case GestureNotifyHold:  event_type = "GestureNotifyHold"; break;
                     case GestureNotifyGroup:  event_type = "GestureNotifyGroup"; break;
-                    default:  event_type = devent_type; sprintf (devent_type, "%ld", (long int)stuff->eventType); break;
+                    default:  event_type = devent_type; snprintf (devent_type, sizeof(devent_type), "%ld", (long int)stuff->eventType); break;
                 }
 
                 REPLY (" event_type(%s) num_finger(%d) time(%lums)",
@@ -142,7 +142,7 @@ _EvlogRequestGesture(EvlogInfo *evinfo, int detail_level, char *reply, int *len)
                     case GestureNotifyTapNHold:  event_type = "GestureNotifyTapNHold"; break;
                     case GestureNotifyHold:  event_type = "GestureNotifyHold"; break;
                     case GestureNotifyGroup:  event_type = "GestureNotifyGroup"; break;
-                    default:  event_type = devent_type; sprintf (devent_type, "%ld", (long int)stuff->eventType); break;
+                    default:  event_type = devent_type; snprintf (devent_type, sizeof(devent_type), "%ld", (long int)stuff->eventType); break;
                 }
 
                 REPLY (" event_type(%s) num_finger(%d) time(%lums)",
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/common/xdbg_evlog_present.c b/common/xdbg_evlog_present.c
new file mode 100644 (file)
index 0000000..254e204
--- /dev/null
@@ -0,0 +1,271 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dix.h>
+#define XREGISTRY
+#include <registry.h>
+#include <xace.h>
+#include <xacestr.h>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <windowstr.h>
+#include <X11/extensions/presentproto.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog_present.h"
+#include "xdbg_evlog.h"
+
+static char *
+_EvlogRequestPresent (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
+{
+    xReq *req = evinfo->req.ptr;
+
+    switch (req->data)
+    {
+    case X_PresentPixmap:
+        {
+            xPresentPixmapReq *stuff = (xPresentPixmapReq *)req;
+            REPLY (": window(0x%x) pixmap(0x%x) (s,v,u)(%u,0x%x,0x%x) x,y(%d,%d) crtc(%u) wait(0x%x) idle(0x%x) op(0x%x) (t,d,r)(%u,%u,%u)",
+                (unsigned int)stuff->window,
+                (unsigned int)stuff->pixmap,
+                (unsigned int)stuff->serial,
+                (unsigned int)stuff->valid,
+                (unsigned int)stuff->update,
+                (int)stuff->x_off,
+                (int)stuff->y_off,
+                (unsigned int)stuff->target_crtc,
+                (unsigned int)stuff->wait_fence,
+                (unsigned int)stuff->idle_fence,
+                (unsigned int)stuff->options,
+                (unsigned int)stuff->target_msc,
+                (unsigned int)stuff->divisor,
+                (unsigned int)stuff->remainder);
+
+            return reply;
+        }
+
+    case X_PresentNotifyMSC:
+        {
+            xPresentNotifyMSCReq *stuff = (xPresentNotifyMSCReq *)req;
+            REPLY (": window(0x%x) serial(%u) target_msc(%lu) divisor(%lu) remainder(%lu)",
+                (unsigned int)stuff->window,
+                (unsigned int)stuff->serial,
+                (unsigned long)stuff->target_msc,
+                (unsigned long)stuff->divisor,
+                (unsigned long)stuff->remainder);
+
+            return reply;
+        }
+
+    case X_PresentSelectInput :
+        {
+            xPresentSelectInputReq *stuff = (xPresentSelectInputReq *)req;
+            REPLY (": eid(0x%x) window(0x%x) eventMask (0x%x)",
+                (unsigned int)stuff->eid,
+                (unsigned int)stuff->window,
+                (unsigned int)stuff->eventMask);
+
+            return reply;
+        }
+
+    case X_PresentQueryCapabilities :
+        {
+            xPresentQueryCapabilitiesReq *stuff = (xPresentQueryCapabilitiesReq *)req;
+            REPLY (": target(0x%x)",
+                (unsigned int)stuff->target);
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+
+static char *
+_EvlogEventPresent (EvlogInfo *evinfo, int first_base, int detail_level, char *reply, int *len)
+{
+    xEvent *evt = evinfo->evt.ptr;
+
+    switch ((evt->u.u.type & 0x7F) - first_base)
+    {
+
+    case PresentConfigureNotify:
+         {
+             xPresentConfigureNotify *stuff = (xPresentConfigureNotify *) evt;
+             REPLY (": window(0x%x)(%ux%u+%d+%d) off x,y (%d,%d)  pximap width(%u) height(%u) flags(0x%x)",
+                 (unsigned int)stuff->window,
+                 (unsigned int)stuff->width,
+                 (unsigned int)stuff->height,
+                 (int)stuff->x,
+                 (int)stuff->y,
+                 (int)stuff->off_x,
+                 (int)stuff->off_y,
+                 (unsigned int)stuff->pixmap_width,
+                 (unsigned int)stuff->pixmap_height,
+                 (unsigned int)stuff->pixmap_flags);
+    
+             evinfo->evt.size = sizeof (xPresentConfigureNotify);
+    
+             return reply;
+         }
+    
+     case PresentCompleteNotify:
+         {
+             xPresentCompleteNotify *stuff = (xPresentCompleteNotify *) evt;
+             REPLY (": window(0x%x) serial(0x%x) kind(%u) mode(%u) ust(%lu)",
+                 (unsigned int)stuff->window,
+                 (unsigned int)stuff->serial,
+                 (unsigned int)stuff->kind,
+                 (unsigned int)stuff->mode,
+                 (unsigned long)stuff->ust);
+    
+            evinfo->evt.size = sizeof (xPresentCompleteNotify);
+
+             return reply;
+         }
+    
+    case PresentIdleNotify:
+        {
+            xPresentIdleNotify *stuff = (xPresentIdleNotify *) evt;
+            REPLY (": window(0x%x) serial(0x%x) pixmap(0x%x) idle_fence(0x%x)",
+                (unsigned int)stuff->window,
+                (unsigned int)stuff->serial,
+                (unsigned int)stuff->pixmap,
+                (unsigned int)stuff->idle_fence);
+    
+            evinfo->evt.size = sizeof (xPresentIdleNotify);
+
+            return reply;
+        }
+#if 0
+    case PresentRedirectNotify:
+        {
+
+            xPresentRedirectNotify *stuff = (xPresentRedirectNotify *) evt;
+            REPLY (": window(0x%x) pixmap(0x%x) serial(%u) valid(0x%x) update(0x%x) x,y_off(%d,%d) target_crtc(%u) wait_fence(0x%x) idle_fence(0x%x) options(0x%x) target_msc(%u) divisor(%u) remainder(%u)",
+                (unsigned int)stuff->pixmap,
+                (unsigned int)stuff->drawable,
+                (unsigned int)stuff->serial,
+                (unsigned int)stuff->valid_region,
+                (unsigned int)stuff->update_region,
+                (int)stuff->x_off,
+                (int)stuff->y_off,
+                (unsigned int)stuff->target_crtc,
+                (unsigned int)stuff->wait_fence,
+                (unsigned int)stuff->idle_fence,
+                (unsigned int)stuff->options,
+                (unsigned int)stuff->target_msc,
+                (unsigned int)stuff->divisor,
+                (unsigned int)stuff->remainder);
+
+            evinfo->evt.size = sizeof (xPresentRedirectNotify);
+
+            return reply;
+        }
+#endif
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+static char *
+_EvlogReplyPresent (EvlogInfo *evinfo, int detail_level, char *reply, int *len)
+{
+    xGenericReply *rep = evinfo->rep.ptr;
+
+    switch (evinfo->rep.reqData)
+    {
+    case X_PresentQueryCapabilities:
+        {
+            if (evinfo->rep.isStart)
+            {
+                xPresentQueryCapabilitiesReply *stuff = (xPresentQueryCapabilitiesReply *)rep;
+                REPLY (": capabilities(0x%x)",
+                    (unsigned int)stuff->capabilities);
+            }
+            else
+            {
+                return reply;
+            }
+
+            return reply;
+        }
+
+    default:
+            break;
+    }
+
+    return reply;
+}
+
+void
+xDbgEvlogPresentGetBase (ExtensionInfo *extinfo)
+{
+#ifdef XDBG_CLIENT
+    RETURN_IF_FAIL (extinfo != NULL);
+
+    extinfo->req_func = _EvlogRequestPresent;
+    extinfo->evt_func = _EvlogEventPresent;
+    extinfo->rep_func = _EvlogReplyPresent;
+#else
+    ExtensionEntry *xext = CheckExtension (PRESENT_NAME);
+    RETURN_IF_FAIL (xext != NULL);
+    RETURN_IF_FAIL (extinfo != NULL);
+
+    extinfo->opcode = xext->base;
+    extinfo->evt_base = xext->eventBase;
+    extinfo->err_base = xext->errorBase;
+    extinfo->req_func = _EvlogRequestPresent;
+    extinfo->evt_func = _EvlogEventPresent;
+    extinfo->rep_func = _EvlogReplyPresent;
+#endif
+}
diff --git a/common/xdbg_evlog_present.h b/common/xdbg_evlog_present.h
new file mode 100644 (file)
index 0000000..60ce61e
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+
+xdbg
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+
+Contact: Boram Park <boram1288.park@samsung.com>
+         Sangjin LEE <lsj119@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef __XDBG_EVLOG_PRESENT_H__
+#define __XDBG_EVLOG_PRESENT_H__
+
+#include "xdbg_types.h"
+
+void    xDbgEvlogPresentGetBase (ExtensionInfo *extinfo);
+
+#endif
index cc4b35d..48ca33c 100644 (file)
@@ -44,11 +44,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define XDBG_PATH_MAX        1024
 #define XDBG_BUF_SIZE        64
 
-#ifdef PATH_MAX
-#undef PATH_MAX
-#endif //PATH_MAX
-#define PATH_MAX XDBG_PATH_MAX
-
 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
 #define SWAP(a, b)  ({int t; t = a; a = b; b = t;})
@@ -86,7 +81,8 @@ typedef enum
     REQUEST,
     REPLY,
     FLUSH,
-    ERROR
+    ERROR,
+    XERROR
 } EvlogType;
 
 #define EVLOG_MASK_CLIENT    (1<<0)
@@ -153,6 +149,8 @@ typedef struct _EvlogReply
 
 typedef struct _EvlogError
 {
+    char errorName[PATH_MAX+1];
+    char majorName[PATH_MAX+1];
     BYTE    errorCode;
     CARD32  resourceID;
     CARD16  minorCode;
index 7843f1e..48dcf3d 100644 (file)
@@ -44,16 +44,26 @@ AH_TOP([#include "xorg-server.h"])
 
 AC_ARG_WITH(xorg-module-dir,
             AC_HELP_STRING([--with-xorg-module-dir=DIR],
-                           [Default xorg module directory [[default=$libdir/xorg/modules]]]),
+                           [directory of xorg module [[default=$libdir/xorg/modules]]]),
                            [moduledir="$withval"],
                            [moduledir="$libdir/xorg/modules"])
+AC_ARG_WITH(dbus-busconfig-dir,
+            AC_HELP_STRING([--with-dbus-busconfig-dir=DIR],
+                           [directory of the xdbg's dbus busconfig file [[default=$sysconfdir/dbus-1/system.d]]]),
+                           [dbusbusconfigdir="$withval"],
+                           [dbusbusconfigdir="$sysconfdir/dbus-1/system.d"])
 AC_ARG_ENABLE(secure-log,
               AS_HELP_STRING([--enable-secure-log],
                              [Enable secure log (default: disabled)]),
                              [SECURELOG=$enableval], [SECURELOG=no])
 
+AC_ARG_ENABLE(normal-log,
+              AS_HELP_STRING([--enable-normal-log],
+                             [Enable normal log instead of secure log (default: disabled)]),
+                             [NORMALLOG=$enableval], [NORMALLOG=no])
+
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XDBG, dlog xorg-server x11 xdamage xext dbus-1 bigreqsproto compositeproto damageproto dri2proto fixesproto fontsproto gestureproto inputproto kbproto randrproto recordproto renderproto resourceproto videoproto xcmiscproto xextproto xf86vidmodeproto xproto libdrm xcomposite libdri2 xgesture xtst xrandr xi xv)
+PKG_CHECK_MODULES(XDBG, dlog xorg-server x11 xdamage xext dbus-1 bigreqsproto compositeproto damageproto dri2proto fixesproto fontsproto gestureproto inputproto kbproto randrproto recordproto renderproto resourceproto videoproto xcmiscproto xextproto xf86vidmodeproto xproto dri3proto presentproto libdrm xcomposite libdri2 xgesture xtst xrandr xi xv xcb)
 
 PKG_CHECK_MODULES(HWC, libhwc hwcproto,
        [SAVE_CPPFLAGS="$CPPFLAGS"
@@ -82,6 +92,7 @@ AC_HEADER_STDC
 MODULE_NAME=xdbg
 AC_SUBST([MODULE_NAME])
 AC_SUBST([moduledir])
+AC_SUBST([dbusbusconfigdir])
 
 AC_DEFINE_UNQUOTED(MODULE_NAME, "$MODULE_NAME", [module name])
 
@@ -91,6 +102,12 @@ if test "x$SECURELOG" = xyes; then
     AC_SUBST([TIZEN_ENGINEER_MODE])
 fi
 
+USE_NORMAL_LOG=0
+if test "x$NORMALLOG" = xyes; then
+    USE_NORMAL_LOG=1
+    AC_SUBST([USE_NORMAL_LOG])
+fi
+
 AC_OUTPUT([Makefile
            common/Makefile
            bin/Makefile
@@ -103,6 +120,7 @@ AC_OUTPUT([Makefile
 
 echo "CFLAGS     : $CFLAGS"
 echo "LDFLAGS    : $LDFLAGS"
+echo "LOG        : secure($SECURELOG) normal($NORMALLOG)"
 echo "XDBG_CFLAGS: $XDBG_CFLAGS"
 echo "XDBG_LIBS  : $XDBG_LIBS"
 echo "XDBG_CLIENT_CFLAGS: $XDBG_CLIENT_CFLAGS"
index 245475f..9a40df7 100644 (file)
@@ -6,6 +6,5 @@ includedir=@includedir@
 Name: xdbg
 Description: The X debug Library
 Version: @PACKAGE_VERSION@
-Requires.private: xorg-server x11 dlog
 Cflags: -I${includedir}/xdbg
 Libs: -L${libdir} -lxdbg-lib
index 9832ab5..806b138 100644 (file)
@@ -187,6 +187,7 @@ _xDbgDumpSetOptions (void)
         char temp[64];
         char *c;
         int nums[4];
+        char *tokp;
 
         if (xdbg_dump_info.crop)
         {
@@ -196,12 +197,12 @@ _xDbgDumpSetOptions (void)
 
         snprintf (temp, sizeof (temp), "%s", xdbg_dump_info.crop_str);
 
-        c = strtok (temp, ",");
+        c = strtok_r (temp, ",", &tokp);
         i = 0;
         while (c != NULL)
         {
             nums[i++] = atoi(c);
-            c = strtok (NULL, ",");
+            c = strtok_r (NULL, ",", &tokp);
             if (i == 4)
                 break;
         }
old mode 100755 (executable)
new mode 100644 (file)
index 2142653..cab0964
@@ -96,6 +96,7 @@ _LogModule (void * handle, int logoption, const char * file, int line, const cha
     const char *name;
     struct timeval  tv;
     struct tm      *tm=NULL;
+    struct tm      result;
 
     if (!h)
         return;
@@ -113,7 +114,7 @@ _LogModule (void * handle, int logoption, const char * file, int line, const cha
         {
             /* get local time from tv */
             gettimeofday(&tv, NULL);
-            tm = localtime(&tv.tv_sec);
+            tm = localtime_r(&tv.tv_sec, &result);
 
             /* write to file */
             if (tm)
@@ -152,7 +153,7 @@ _LogModule (void * handle, int logoption, const char * file, int line, const cha
         if( tm == NULL )
         {
             gettimeofday(&tv, NULL);
-            tm = localtime(&tv.tv_sec);
+            tm = localtime_r(&tv.tv_sec, &result);
         }
 
         tv_ms = tv.tv_usec/1000;
index 5829221..1091672 100644 (file)
@@ -38,6 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include <errno.h>
 #include <stdlib.h>
+#include <xorg-server.h>
 #include <os.h>
 #include <xdbg_log_secure.h>
 
@@ -109,8 +110,12 @@ void* xDbgLog            (unsigned int module, int logoption, const char *file,
 #if TIZEN_ENGINEER_MODE
 #define XDBG_SECURE(mod, fmt, ARG...)     XLOG_SECURE(mod, "[%s] "fmt, __FUNCTION__, ##ARG)
 #else
+#if USE_NORMAL_LOG
+#define XDBG_SECURE(mod, fmt, ARG...)     XLOG_INFO(mod, "[%s] "fmt, __FUNCTION__, ##ARG)
+#else
 #define XDBG_SECURE(mod, fmt, ARG...)     do { } while(0)
 #endif
+#endif
 
 #define XDBG_NEVER_GET_HERE(mod)          XLOG_ERROR(mod, "[%s:%d] ** NEVER GET HERE **\n", __FUNCTION__,__LINE__)
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 9644600..42005c4
@@ -103,6 +103,7 @@ const struct {
     {CREATE_PIXMAP_USAGE_FB,             "fb"},
     {CREATE_PIXMAP_USAGE_SUB_FB,         "sub_fb"},
     {CREATE_PIXMAP_USAGE_DRI2_BACK,      "dri2_back"},
+    {CREATE_PIXMAP_USAGE_DRI3_BACK,      "dri3"},
     /******END********/
     {0, "normal"}
 };
@@ -388,7 +389,7 @@ XDbgLogSetWindowPixmap (WindowPtr pWin, PixmapPtr pPixmap)
     pScreen->SetWindowPixmap (pWin, pPixmap);
     pScreen->SetWindowPixmap = XDbgLogSetWindowPixmap;
 
-    if (pPixmap != pScreen->GetWindowPixmap(pParent))
+    if (pParent && pPixmap != pScreen->GetWindowPixmap(pParent))
     {
         //Add to window list
         p = _findXDbgPixmap (pPixmap);
@@ -420,6 +421,8 @@ XDbgLogSetWindowPixmap (WindowPtr pWin, PixmapPtr pPixmap)
             XDBG_TRACE (MMEM, " Unset WinPixmap win(0x%x), pixmap(%p) hint:%s\n",
                                    (unsigned int)pWin->drawable.id, p->pPixmap, p->hint);
             xorg_list_del (&d->pRefPixmap->link);
+            XDbgPixmap * pix = _findXDbgPixmap (d->pRefPixmap->pPixmap);
+            if (pix) pix->refs--;
             free (d->pRefPixmap);
             d->pRefPixmap = NULL;
         }
@@ -438,6 +441,8 @@ XDbgLogSetWindowPixmap (WindowPtr pWin, PixmapPtr pPixmap)
         d->pRefPixmap = p_ref;
 
         p->refs++;
+        if (p->numHistory >= MAX_HISTORY)
+            memmove(p->refHistorys, &(p->refHistorys[1]), --(p->numHistory));
         p->refHistorys[p->numHistory++] = pWin->drawable.id;
 
         XDBG_TRACE (MMEM, " Set WinPixmap win(0x%x), pixmap(%p) hint:%s\n",
index 26ba48d..1237545 100644 (file)
@@ -58,6 +58,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define CREATE_PIXMAP_USAGE_DRI2_BACK       0x404
 #endif
 
+/* pixmap usage_hint stands for dri3 pixmap */
+#ifndef CREATE_PIXMAP_USAGE_DRI3_BACK
+#define CREATE_PIXMAP_USAGE_DRI3_BACK       0x606
+#endif
+
 void xDbgLogPListInit              (ScreenPtr pScreen);
 void xDbgLogPListDeInit            (ScreenPtr pScreen);
 
index beac738..6355d47 100644 (file)
@@ -37,5 +37,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define  __XDBG_LOG_SECURE_H__
 
 #define TIZEN_ENGINEER_MODE @TIZEN_ENGINEER_MODE@
+#define USE_NORMAL_LOG @USE_NORMAL_LOG@
 
 #endif  /*  __XDBG_LOG_SECURE_H__ */
index 2ffdc59..e1561b8 100644 (file)
@@ -22,6 +22,9 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
+configdir = @dbusbusconfigdir@
+config_DATA = xdbg.conf
+
 libxdbg_la_LTLIBRARIES = libxdbg.la
 libxdbg_ladir = @moduledir@
 libxdbg_la_LIBADD = @XDBG_LIBS@ ../common/libcommon-server.la ../lib/libxdbg-lib.la
diff --git a/module/xdbg.conf b/module/xdbg.conf
new file mode 100644 (file)
index 0000000..c484332
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+    <policy user="root">
+        <allow own="org.x.dbg.server"/>
+        <allow own="org.x.dbg.client"/>
+    </policy>
+    <policy at_console="true">
+        <allow send_destination="org.x.dbg.server"/>
+    </policy>
+    <policy context="default">
+        <allow send_destination="org.x.dbg.server"/>
+    </policy>
+</busconfig>
+
index eb5c35e..e81e104 100644 (file)
@@ -96,6 +96,8 @@ xDbgModuleSetup (pointer module, pointer opts, int *errmaj, int *errmin)
         /* Parse Options */
         xDbgModuleParseOptions (&module_xdbg, pOpt);
 
+        xorg_list_init (&module_xdbg.trace_list);
+
         /* Register block handler */
         RegisterBlockAndWakeupHandlers (_xDbgModuleBlockHandler,
                                        (WakeupHandlerProcPtr)NoopDDA,
index f354d62..80ac221 100644 (file)
@@ -46,6 +46,22 @@ typedef struct _ModuleClientInfo
     char   command[PATH_MAX+1];
 } ModuleClientInfo;
 
+typedef struct _XDbgModuleTraceClientOption
+{
+    char   name[PATH_MAX+1];
+    char   action[PATH_MAX+1];
+    char   cmd[PATH_MAX+1];
+} ModuleTraceClientOption;
+
+typedef struct _XDbgModuleTraceClient
+{
+    struct xorg_list link;
+
+    int    pid;
+    char   name[PATH_MAX+1];
+    int    conn_cnt;
+} ModuleTraceClient;
+
 typedef struct _XDbgModule
 {
     Bool  dlog;
@@ -53,6 +69,11 @@ typedef struct _XDbgModule
     char *evlog_path;
     char *evlog_rule_path;
     char *cwd;
+    char *xerror_log_path;
+    int  trace_cnt;
+
+    ModuleTraceClientOption *trace_options;
+    struct xorg_list trace_list; /* trace client list */
 } XDbgModule;
 
 extern DevPrivateKeyRec debug_client_key;
index 4a2bd2a..021389a 100644 (file)
@@ -34,11 +34,29 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include "xdbg.h"
 #include "xdbg_types.h"
 #include "xdbg_module.h"
+#include "xdbg_module_clist.h"
 
+static ModuleTraceClientOption*
+_findTraceClientOption (XDbgModule *pMod, char *client_name)
+{
+    int i = 0;
+
+    for (i = 0 ; i < pMod->trace_cnt ; i++)
+    {
+        ModuleTraceClientOption *option = &pMod->trace_options[i];
+        if (!strcmp(client_name, option->name))
+        {
+            return option;
+        }
+    }
+    return NULL;
+}
 
 void
 xDbgModuleCList (XDbgModule *pMod, char *reply, int *len)
@@ -63,3 +81,124 @@ xDbgModuleCList (XDbgModule *pMod, char *reply, int *len)
                         info->index, info->pid, pClient->ignoreCount, info->command);
     }
 }
+
+
+void
+xDbgModuleClistTraceInit (XDbgModule *pMod)
+{
+    int i = 0;
+
+    for (i = 1 ; i < currentMaxClients ; i++)
+    {
+        ClientPtr pClient = clients[i];
+        ModuleClientInfo *info;
+
+        if (!pClient)
+            continue;
+
+        info = GetClientInfo (pClient);
+        xDbgModuleClistTraceAdd (pMod, info);
+    }
+}
+
+void
+xDbgModuleClistTraceAdd (XDbgModule *pMod, ModuleClientInfo *info)
+{
+    char *client_name = strrchr (info->command, '/');
+    ModuleTraceClient *trace_client = NULL;
+    ModuleTraceClient *client = NULL, *tmp = NULL;
+    ModuleTraceClientOption *option = NULL;
+
+    XDBG_DEBUG (MXDBG, "[TRACE_CLIENT] AddClist Trace command %s\n", info->command);
+
+    if (client_name)
+        client_name = client_name+1;
+    else
+        client_name = info->command;
+
+    if (!(option = _findTraceClientOption (pMod, client_name)))
+        return;
+
+    xorg_list_for_each_entry_safe(client, tmp, &pMod->trace_list, link) {
+        if (client->pid == info->pid)
+        {
+            XDBG_DEBUG (MXDBG, "[TRACE_CLIENT] Find Trace list:%s conn_cnt:%d+1\n", client_name, client->conn_cnt);
+            client->conn_cnt++;
+            return;
+        }
+    }
+
+    trace_client = (ModuleTraceClient *) calloc (1, sizeof(ModuleTraceClient));
+    XDBG_RETURN_IF_FAIL (trace_client != NULL);
+
+    trace_client->pid = info->pid;
+    trace_client->conn_cnt = 1;
+    strncpy (trace_client->name, client_name, strlen(client_name)+1);
+
+    XDBG_DEBUG (MXDBG, "[TRACE_CLIENT] Add Trace list:%s conn_cnt:%d\n", client_name, trace_client->conn_cnt);
+    xorg_list_add (&trace_client->link, &pMod->trace_list);
+
+    return;
+}
+
+void
+xDbgModuleClistTraceRemove (XDbgModule *pMod, ModuleClientInfo *info)
+{
+    char *client_name = strrchr (info->command, '/');
+    ModuleTraceClient *client = NULL, *tmp = NULL;
+    ModuleTraceClientOption *option = NULL;
+
+    XDBG_DEBUG (MXDBG, "[TRACE_CLIENT] RevmoeClist Trace command %s\n", info->command);
+
+    if (client_name)
+        client_name = client_name+1;
+    else
+        client_name = info->command;
+
+    if (!(option = _findTraceClientOption (pMod, client_name)))
+        return;
+
+    xorg_list_for_each_entry_safe(client, tmp, &pMod->trace_list, link) {
+        if (client->pid == info->pid)
+        {
+            if (client->conn_cnt == 1)
+            {
+                if (!strcmp(option->action, "cmd"))
+                {
+                    int ret = 0;
+                    ErrorF ("[TRACE_CLIENT] Disconnect Trace client:%s pid:%d cmd:%s", client->name, client->pid, option->cmd);
+                    if (strstr(option->cmd, "reboot"))
+                        sleep (1);
+
+                    ret = system (option->cmd);
+                    ErrorF (" ret:%d\n", ret);
+                }
+                else if (!strcmp(option->action, "error"))
+                {
+
+                    FatalError ("[TRACE_CLIENT] %s\n", option->cmd);
+                    ErrorF ("[TRACE_CLIENT] Disconnect Trace client:%s pid:%d msg:%s\n", client->name, client->pid, option->cmd);
+
+                }
+                else if (!strcmp(option->action, "log"))
+                {
+                    ErrorF ("[TRACE_CLIENT] Disconnect Trace client:%s pid:%d msg:%s\n", client->name, client->pid, option->cmd);
+                }
+                else
+                {
+                    XDBG_DEBUG (MXDBG, "[TRACE_CLIENT] Unkown action Trace client:%s pid:%d action:%s cmd:%s\n",
+                                client->name, client->pid, option->action, option->cmd);
+                }
+
+                xorg_list_del (&client->link);
+            }
+            else
+            {
+                XDBG_DEBUG (MXDBG, "[TRACE_CLIENT] Unref client:%s conn_cnt:%d-1 \n", client_name, client->conn_cnt);
+                client->conn_cnt--;
+            }
+            return;
+        }
+    }
+    return;
+}
index c49f71c..a257dd5 100644 (file)
@@ -35,5 +35,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xdbg_module.h"
 
 void xDbgModuleCList (XDbgModule *pMod, char *reply, int *len);
+void xDbgModuleClistTraceInit (XDbgModule *pMod);
+void xDbgModuleClistTraceAdd (XDbgModule *pMod, ModuleClientInfo *info);
+void xDbgModuleClistTraceRemove (XDbgModule *pMod, ModuleClientInfo *info);
 
 #endif /* __XDBG_MODULE_CLIST_H__ */
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index dd6180b..be401c7
@@ -606,6 +606,7 @@ xDbgModuleCommandInitLogPath (XDbgModule *pMod, char *log_path)
     {
         char newname[XDBG_PATH_MAX];
         char filename[XDBG_PATH_MAX];
+        struct stat status;
         char *p = NULL, *last = NULL;
         int i;
 
@@ -621,9 +622,9 @@ xDbgModuleCommandInitLogPath (XDbgModule *pMod, char *log_path)
         snprintf (filename, XDBG_PATH_MAX, "%s", last + 1);
         snprintf (last, XDBG_PATH_MAX - (last - newname), "/prev.%s", filename);
 
-        if (rename (log_path, newname))
+        if (!stat (log_path, &status))
         {
-            if (errno != ENOENT)
+            if (rename (log_path, newname))
             {
                 XDBG_ERROR (MXDBG, "Failed: rename %s -> %s\n", log_path, newname);
                 return FALSE;
index 3ce9b51..39a80ca 100644 (file)
@@ -67,6 +67,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define XREGISTRY
 #include "registry.h"
 
+#include <dlog.h>
+
 #define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
 
 Bool       xev_trace_on = FALSE;
@@ -75,6 +77,30 @@ static int  xev_trace_fd = -1;
 static int  xev_trace_record_fd = -1;
 static Atom atom_client_pid = None;
 static int  init = 0;
+static char *xerror_path = NULL;
+
+void
+xDbgModuleEvlogXErrorSetPath (char *path)
+{
+    xerror_path = path;
+}
+
+static void xErrorPrint (EvlogInfo *evinfo, const char *f, ...)
+{
+    va_list args;
+
+    va_start (args, f);
+    if (!strcmp (xerror_path, "dlog"))
+    {
+        const char * error_tag = "XERROR";
+        SLOG_VA (LOG_DEBUG, error_tag, f, args);
+    }
+    else if (!strcmp (xerror_path, "xorg"))
+    {
+        LogVWrite (1, f, args);
+    }
+    va_end (args);
+}
 
 static void evtRecord (int fd, EvlogInfo *evinfo)
 {
@@ -346,7 +372,7 @@ static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec
                           LookupRequestName (stuff->reqType, stuff->data));
         }
 
-        if (type == ERROR)
+        if (type == ERROR || type == XERROR)
         {
             xError* err = NULL;
 
@@ -362,6 +388,10 @@ static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec
                 evinfo.err.resourceID = err->resourceID;
                 evinfo.err.minorCode = err->minorCode;
                 evinfo.err.majorCode = err->majorCode;
+                snprintf (evinfo.err.errorName, sizeof (evinfo.err.errorName), "%s",
+                            LookupErrorName(err->errorCode));
+                snprintf (evinfo.err.majorName, sizeof (evinfo.err.majorName), "%s",
+                            LookupMajorName(err->majorCode));
             }
             else
                 XDBG_NEVER_GET_HERE (MXDBG);
@@ -384,7 +414,7 @@ static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec
     evinfo.time = GetTimeInMillis ();
 
     /* get extension entry */
-    if (!EntryInit && !xDbgEvlogGetExtensionEntry (NULL))
+    if (!EntryInit && !xDbgEvlogGetExtensionEntry ())
         return;
 
     EntryInit = 1;
@@ -392,7 +422,15 @@ static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec
     if (!xDbgEvlogRuleValidate (&evinfo))
         return;
 
-    if (xev_trace_record_fd >= 0)
+    if (type == XERROR)
+    {
+        char log[1024];
+        int size = sizeof (log);
+
+        if (xDbgEvlogFillLog (&evinfo, xev_trace_detail_level, log, &size))
+            xErrorPrint (&evinfo, "%s", log);
+    }
+    else if (xev_trace_record_fd >= 0)
     {
         if (xDbgEvlogFillLog (&evinfo, EVLOG_PRINT_REPLY_DETAIL, NULL, NULL))
             evtRecord (xev_trace_record_fd, &evinfo);
@@ -411,7 +449,7 @@ static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec
     xDbgDistroyRegionList(&evinfo);
 }
 
-#if TIZEN_ENGINEER_MODE
+#if (TIZEN_ENGINEER_MODE || USE_NORMAL_LOG)
 static const char*
 _traceGetWindowName (ClientPtr client, Window window)
 {
@@ -477,7 +515,7 @@ _traceEvent (CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
     static int xi2_opcode = -1;
     xEvent *pev;
 
-#if TIZEN_ENGINEER_MODE
+#if (TIZEN_ENGINEER_MODE || USE_NORMAL_LOG)
     static char* ename[]=
     {
         "KeyPress",
@@ -550,10 +588,14 @@ _traceEvent (CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
             }
         }
 
+        if (type == X_Error && xerror_path)
+            evtPrint (XERROR, pClient, pev, NULL);
+
         if (type != X_Error && xev_trace_on)
             evtPrint (EVENT, pClient, pev, NULL);
         else if (type == X_Error && xev_trace_on)
             evtPrint (ERROR, pClient, pev, NULL);
+
     }
 }
 
@@ -716,7 +758,13 @@ xDbgModuleEvlogPrintEvents (XDbgModule *pMod, Bool on, const char * client_name,
                 snprintf (fd_name, 256, "/proc/%d/fd/1", info->pid);
                 xev_trace_fd = open (fd_name, O_RDWR);
                 if (xev_trace_fd < 0)
-                    XDBG_REPLY ("failed: open consol '%s'. (%s)\n", fd_name, strerror(errno));
+                {
+                    char err_buf[256] = {0,};
+                    char *errp;
+
+                    errp = (char *)strerror_r (errno, err_buf, sizeof(err_buf));
+                    XDBG_REPLY ("failed: open consol '%s'. (%s)\n", fd_name, errp);
+                }
             }
         }
 
@@ -790,7 +838,13 @@ xDbgModuleEvlogSetEvlogPath (XDbgModule *pMod, int pid, char *path, char *reply,
 
             xev_trace_fd = open (fd_name, O_RDWR);
             if (xev_trace_fd < 0)
-                XDBG_REPLY ("failed: open consol '%s'. (%s)\n", fd_name, strerror(errno));
+            {
+                char err_buf[256] = {0,};
+                char *errp;
+
+                errp = (char *)strerror_r (errno, err_buf, sizeof(err_buf));
+                XDBG_REPLY ("failed: open consol '%s'. (%s)\n", fd_name, errp);
+            }
 
             pMod->evlog_path = strdup (fd_name);
         }
@@ -819,7 +873,11 @@ xDbgModuleEvlogSetEvlogPath (XDbgModule *pMod, int pid, char *path, char *reply,
     xev_trace_record_fd = open (fd_name, O_CREAT|O_RDWR|O_APPEND, 0755);
     if (xev_trace_record_fd < 0)
     {
-        XDBG_REPLY ("failed: open file '%s'. (%s)\n", fd_name, strerror(errno));
+        char err_buf[256] = {0,};
+        char *errp;
+
+        errp = (char *)strerror_r (errno, err_buf, sizeof(err_buf));
+        XDBG_REPLY ("failed: open file '%s'. (%s)\n", fd_name, errp);
         return FALSE;
     }
 
index 8e94aca..bea5eb5 100644 (file)
@@ -34,6 +34,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "xdbg_module.h"
 
+void    xDbgModuleEvlogXErrorSetPath (char *path);
+
 Bool    xDbgModuleEvlogInstallHooks   (XDbgModule *pMod);
 void    xDbgModuleEvlogUninstallHooks (XDbgModule *pMod);
 
index 3f42c5b..1acc4fc 100644 (file)
@@ -43,6 +43,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xdbg_module.h"
 #include "xdbg_module_command.h"
 #include "xdbg_module_evlog.h"
+#include "xdbg_module_clist.h"
 
 #define __USE_GNU
 #include <sys/socket.h>
@@ -110,6 +111,7 @@ _traceClientState (CallbackListPtr *list, pointer closure, pointer calldata)
     NewClientInfoRec *clientinfo = (NewClientInfoRec*)calldata;
     ClientPtr client = clientinfo->client;
     ModuleClientInfo *info = GetClientInfo (client);
+    XDbgModule *pMod = (XDbgModule *)closure;
     static char* clientState[]=
     {
         "ClientStateInitial",
@@ -127,8 +129,19 @@ _traceClientState (CallbackListPtr *list, pointer closure, pointer calldata)
     if ((client->clientState == ClientStateInitial) || (client->clientState == ClientStateGone))
     {
         if (client->clientState == ClientStateInitial)
+        {
               _debugClientInfo (client);
 
+              if (pMod->trace_cnt)
+                  xDbgModuleClistTraceAdd (pMod, info);
+        }
+
+        if (client->clientState == ClientStateGone)
+        {
+              if (pMod->trace_cnt)
+                xDbgModuleClistTraceRemove (pMod, info);
+        }
+
         XDBG_SECURE (MXDBG, "id:%d, conn_fd:%d, pid:%d, uid:%d, name:%s (%s)\n",
               info->index, info->conn_fd, info->pid, info->uid, info->command,
               clientState[client->clientState]);
@@ -151,6 +164,9 @@ xDbgModuleMain (XDbgModule *pMod)
         return FALSE;
     }
 
+    if (pMod->trace_cnt)
+        xDbgModuleClistTraceInit (pMod);
+
     ret &= AddCallback (&ClientStateCallback, _traceClientState, pMod);
 
     if (!ret)
@@ -185,5 +201,7 @@ xDbgModuleMainExit (XDbgModule *pMod)
 
     xDbgDBusServerRemoveMethod (&method);
 
+    free (pMod->trace_options);
+
     xDbgDBusServerDisconnect ();
 }
index b885835..86795f7 100644 (file)
@@ -47,18 +47,65 @@ typedef enum
     OPTION_LOG_LEVEL,
     OPTION_EVLOG_PATH,
     OPTION_EVLOG_RULE_PATH,
+    OPTION_XERROR_LOG_PATH,
+    OPTION_TRACE_CNT,
 } ModuleOption;
 
 static const OptionInfoRec module_options[] =
 {
-    { OPTION_DLOG,                     "dlog",                 OPTV_BOOLEAN,   {0},    FALSE },
-    { OPTION_LOG_PATH,         "log_path",             OPTV_STRING,    {0},    FALSE },
-    { OPTION_LOG_LEVEL,                "log_level",    OPTV_INTEGER,   {0},    FALSE },
-    { OPTION_EVLOG_PATH,       "evlog_path",   OPTV_STRING,    {0},    FALSE },
-    { OPTION_EVLOG_RULE_PATH,  "evlog_rule_path",              OPTV_STRING,    {0},    FALSE },
-    { -1,                              NULL,                           OPTV_NONE,              {0},    FALSE }
+    { OPTION_DLOG,             "dlog",             OPTV_BOOLEAN,  {0},    FALSE },
+    { OPTION_LOG_PATH,         "log_path",         OPTV_STRING,   {0},    FALSE },
+    { OPTION_LOG_LEVEL,        "log_level",        OPTV_INTEGER,  {0},    FALSE },
+    { OPTION_EVLOG_PATH,       "evlog_path",       OPTV_STRING,   {0},    FALSE },
+    { OPTION_EVLOG_RULE_PATH,  "evlog_rule_path",  OPTV_STRING,   {0},    FALSE },
+    { OPTION_XERROR_LOG_PATH,  "xerror_log_path",  OPTV_STRING,   {0},    FALSE },
+    { OPTION_TRACE_CNT,        "trace_cnt",        OPTV_INTEGER,  {0},    FALSE },
+    { -1,                      NULL,               OPTV_NONE,     {0},    FALSE }
 };
 
+static void
+xDbgModuleInitTraceClientOptions (XDbgModule *pMod, XF86OptionPtr pOpt)
+{
+    int i = 0;
+    char name[128];
+    char *option = NULL;
+
+    pMod->trace_options = (ModuleTraceClientOption*) calloc (pMod->trace_cnt, sizeof(ModuleTraceClientOption));
+
+    for (i = 0 ; i < pMod->trace_cnt ; i++)
+    {
+        snprintf (name, sizeof(name), "trace_client%d", i+1);
+
+        option = xf86SetStrOption (pOpt, name, NULL);
+        XDBG_INFO (MXDBG, "trace_client%d : %s\n", i+1, option);
+        if (option)
+        {
+            char *token = NULL;
+            char *tokp = NULL;
+
+            token = strtok_r (option, ":", &tokp);
+            if (token)
+                strncpy (pMod->trace_options[i].name, token, strlen(token)+1);
+            else
+                XDBG_WARNING (MXDBG, "fail to parse trace client name:%s\n", option);
+
+            token = strtok_r (NULL, ":", &tokp);
+            if (token)
+                strncpy (pMod->trace_options[i].action, token, strlen(token)+1);
+            else
+                XDBG_WARNING (MXDBG, "fail to parse trace client action:%s\n", option);
+
+            token = strtok_r (NULL, ":", &tokp);
+            if (token)
+                strncpy (pMod->trace_options[i].cmd, token, strlen(token)+1);
+            else
+                XDBG_WARNING (MXDBG, "fail to parse trace client log or cmd:%s\n", option);
+
+            free (option);
+        }
+    }
+}
+
 void
 xDbgModuleParseOptions (XDbgModule *pMod, XF86OptionPtr pOpt)
 {
@@ -108,5 +155,21 @@ xDbgModuleParseOptions (XDbgModule *pMod, XF86OptionPtr pOpt)
         xDbgModuleCommandInitEvlogRulePath (pMod, temp);
     }
 
+    /* xerror_log_path */
+    path = xf86GetOptValString (options, OPTION_XERROR_LOG_PATH);
+    if (path)
+    {
+        pMod->xerror_log_path = strdup (path);
+        xDbgModuleEvlogXErrorSetPath (pMod->xerror_log_path);
+        XDBG_INFO (MXDBG, "evlog log path: \"%s\"\n", path);
+    }
+    else
+        pMod->xerror_log_path = NULL;
+
+    xf86GetOptValInteger (options, OPTION_TRACE_CNT, &pMod->trace_cnt);
+    XDBG_INFO (MXDBG, "trace_cnt: %d\n", pMod->trace_cnt);
+
+    xDbgModuleInitTraceClientOptions (pMod, pOpt);
+
     free (options);
 }
index b260b74..8b553b9 100644 (file)
@@ -1,7 +1,7 @@
 Name: xorg-x11-module-xdbg
 Summary: Xserver debug module
 Version: 0.1.47
-Release:    1
+Release:    3
 VCS:        adaptation/xorg/driver/xserver-xorg-module-xdbg#xorg-x11-module-xdbg-0.1.13-1-79-gfb1d23b62faa7f302ac1b19ff1d3f757c4745b13
 Group:      System/Libraries
 License:    MIT
@@ -35,6 +35,8 @@ BuildRequires:  pkgconfig(xcmiscproto)
 BuildRequires:  pkgconfig(xextproto)
 BuildRequires:  pkgconfig(xf86vidmodeproto)
 BuildRequires:  pkgconfig(xproto)
+BuildRequires:  pkgconfig(dri3proto)
+BuildRequires:  pkgconfig(presentproto)
 BuildRequires:  pkgconfig(libdrm)
 BuildRequires:  pkgconfig(xtst)
 BuildRequires:  pkgconfig(xi)
@@ -83,6 +85,7 @@ cp -af COPYING %{buildroot}/usr/share/license/%{name}
 %{_bindir}/xevlog_analyze
 %{_libdir}/libxdbg-lib.so.*
 %{_libdir}/xorg/modules/libxdbg.so
+%{_sysconfdir}/dbus-1/system.d/xdbg.conf
 
 %files devel
 %dir %{_includedir}/xdbg/
index 7f541e8..e18f38e 100644 (file)
@@ -1,9 +1,9 @@
 <manifest>
         <request>
-                <domain name="_"/>
+                <domain name="xorg"/>
         </request>
-        <assign>
-                <filesystem path="/usr/bin/*" label="_" exec_label="none" />
+         <assign>
+            <filesystem path="/etc/dbus-1/system.d/xdbg.conf" label="_" />
         </assign>
 </manifest>