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");
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;
}
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;
}
if (!new_argv)
{
printf ("failed: malloc new argv\n");
- exit (-1);
+ return 0;
}
snprintf (temp, sizeof(temp), "%d", (int)getpid());
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 \
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;
#include <dbus/dbus.h>
#include <os.h>
#include <dix.h>
+#include <fcntl.h>
#include "xdbg.h"
#include "xdbg_types.h"
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)
{
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;
#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;
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,
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;
}
{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
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
{
#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
#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)
if(vlist)
{
pVlist = vlist;
-
+
if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth)))) {
GET_INT16(CWX, x);
GET_INT16(CWY, y);
GET_CARD16(CWHeight, h);
}
}
-
+
for (i = 0 ; i < sizeof(mask) * 4 ; i++)
{
if(mask & (1 << i))
\r REPLY ("(");
reply = _getWindowAttributeMask(stuff->valueMask, reply, len);
if (stuff->valueMask == CWEventMask)
-
+
REPLY (", mask(%x)", (unsigned int)*((XID *)&stuff[1]));
\r REPLY (")");
}
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;
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;
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)
}
return reply;
-}
\ No newline at end of file
+}
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,
--- /dev/null
+/**************************************************************************
+
+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
+}
--- /dev/null
+/**************************************************************************
+
+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
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)",
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)",
--- /dev/null
+/**************************************************************************
+
+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
+}
--- /dev/null
+/**************************************************************************
+
+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
#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;})
REQUEST,
REPLY,
FLUSH,
- ERROR
+ ERROR,
+ XERROR
} EvlogType;
#define EVLOG_MASK_CLIENT (1<<0)
typedef struct _EvlogError
{
+ char errorName[PATH_MAX+1];
+ char majorName[PATH_MAX+1];
BYTE errorCode;
CARD32 resourceID;
CARD16 minorCode;
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"
MODULE_NAME=xdbg
AC_SUBST([MODULE_NAME])
AC_SUBST([moduledir])
+AC_SUBST([dbusbusconfigdir])
AC_DEFINE_UNQUOTED(MODULE_NAME, "$MODULE_NAME", [module name])
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
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"
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
char temp[64];
char *c;
int nums[4];
+ char *tokp;
if (xdbg_dump_info.crop)
{
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;
}
const char *name;
struct timeval tv;
struct tm *tm=NULL;
+ struct tm result;
if (!h)
return;
{
/* 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)
if( tm == NULL )
{
gettimeofday(&tv, NULL);
- tm = localtime(&tv.tv_sec);
+ tm = localtime_r(&tv.tv_sec, &result);
}
tv_ms = tv.tv_usec/1000;
#include <errno.h>
#include <stdlib.h>
+#include <xorg-server.h>
#include <os.h>
#include <xdbg_log_secure.h>
#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__)
{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"}
};
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);
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;
}
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",
#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);
#define __XDBG_LOG_SECURE_H__
#define TIZEN_ENGINEER_MODE @TIZEN_ENGINEER_MODE@
+#define USE_NORMAL_LOG @USE_NORMAL_LOG@
#endif /* __XDBG_LOG_SECURE_H__ */
# 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
--- /dev/null
+<!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>
+
/* Parse Options */
xDbgModuleParseOptions (&module_xdbg, pOpt);
+ xorg_list_init (&module_xdbg.trace_list);
+
/* Register block handler */
RegisterBlockAndWakeupHandlers (_xDbgModuleBlockHandler,
(WakeupHandlerProcPtr)NoopDDA,
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;
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;
#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)
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;
+}
#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
{
char newname[XDBG_PATH_MAX];
char filename[XDBG_PATH_MAX];
+ struct stat status;
char *p = NULL, *last = NULL;
int i;
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;
#define XREGISTRY
#include "registry.h"
+#include <dlog.h>
+
#define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
Bool xev_trace_on = FALSE;
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)
{
LookupRequestName (stuff->reqType, stuff->data));
}
- if (type == ERROR)
+ if (type == ERROR || type == XERROR)
{
xError* err = NULL;
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);
evinfo.time = GetTimeInMillis ();
/* get extension entry */
- if (!EntryInit && !xDbgEvlogGetExtensionEntry (NULL))
+ if (!EntryInit && !xDbgEvlogGetExtensionEntry ())
return;
EntryInit = 1;
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);
xDbgDistroyRegionList(&evinfo);
}
-#if TIZEN_ENGINEER_MODE
+#if (TIZEN_ENGINEER_MODE || USE_NORMAL_LOG)
static const char*
_traceGetWindowName (ClientPtr client, Window window)
{
static int xi2_opcode = -1;
xEvent *pev;
-#if TIZEN_ENGINEER_MODE
+#if (TIZEN_ENGINEER_MODE || USE_NORMAL_LOG)
static char* ename[]=
{
"KeyPress",
}
}
+ 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);
+
}
}
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);
+ }
}
}
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);
}
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;
}
#include "xdbg_module.h"
+void xDbgModuleEvlogXErrorSetPath (char *path);
+
Bool xDbgModuleEvlogInstallHooks (XDbgModule *pMod);
void xDbgModuleEvlogUninstallHooks (XDbgModule *pMod);
#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>
NewClientInfoRec *clientinfo = (NewClientInfoRec*)calldata;
ClientPtr client = clientinfo->client;
ModuleClientInfo *info = GetClientInfo (client);
+ XDbgModule *pMod = (XDbgModule *)closure;
static char* clientState[]=
{
"ClientStateInitial",
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]);
return FALSE;
}
+ if (pMod->trace_cnt)
+ xDbgModuleClistTraceInit (pMod);
+
ret &= AddCallback (&ClientStateCallback, _traceClientState, pMod);
if (!ret)
xDbgDBusServerRemoveMethod (&method);
+ free (pMod->trace_options);
+
xDbgDBusServerDisconnect ();
}
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)
{
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);
}
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
BuildRequires: pkgconfig(xextproto)
BuildRequires: pkgconfig(xf86vidmodeproto)
BuildRequires: pkgconfig(xproto)
+BuildRequires: pkgconfig(dri3proto)
+BuildRequires: pkgconfig(presentproto)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(xtst)
BuildRequires: pkgconfig(xi)
%{_bindir}/xevlog_analyze
%{_libdir}/libxdbg-lib.so.*
%{_libdir}/xorg/modules/libxdbg.so
+%{_sysconfdir}/dbus-1/system.d/xdbg.conf
%files devel
%dir %{_includedir}/xdbg/
<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>