read_len = read (fd, &evinfo.type, sizeof (EvlogType));
GOTO_IF_FAIL (read_len == sizeof (EvlogType), print_done);
- GOTO_IF_FAIL (evinfo.type >= EVENT && evinfo.type <= FLUSH, print_done);
+ GOTO_IF_FAIL (evinfo.type >= EVENT && evinfo.type <= ERROR, print_done);
total += read_len;
read_len = read (fd, &evinfo.mask, sizeof (int));
total += read_len;
}
+ if (evinfo.mask & EVLOG_MASK_REPLY)
+ {
+ read_len = read (fd, &evinfo.rep, sizeof(EvlogReply));
+ GOTO_IF_FAIL (read_len == sizeof(EvlogReply), print_done);
+ total += read_len;
+
+ evinfo.rep.ptr = malloc (evinfo.rep.size);
+ GOTO_IF_FAIL (evinfo.rep.ptr != NULL, print_done);
+
+ WARNING_IF_FAIL (evinfo.rep.size > 0);
+
+ read_len = read (fd, evinfo.rep.ptr, evinfo.rep.size);
+ GOTO_IF_FAIL (read_len == evinfo.rep.size, print_done);
+ total += read_len;
+ }
+
+ if (evinfo.mask & EVLOG_MASK_ERROR)
+ {
+ read_len = read (fd, &evinfo.err, sizeof(EvlogError));
+ GOTO_IF_FAIL (read_len == sizeof(EvlogError), print_done);
+ total += read_len;
+ }
+
if (evinfo.mask & EVLOG_MASK_ATOM)
{
EvlogAtomTable *table;
if(opt_str_len > 0)
{
int fd = -1;
- char fs[1024];
+ char fs[8096];
char *pfs;
int len;
xdbg_evlog_xinput.c \
xdbg_evlog_xv.c \
xdbg_evlog_event.c \
+ xdbg_evlog_reply.c \
ds/bintree.c \
ds/bool_exp_parser.c \
ds/bool_exp_rule_checker.c \
type_string = "REPLY";
else if (args->type == 3)
type_string = "FLUSH";
+ else if (args->type == 4)
+ type_string = "ERROR";
else
{
fprintf (stderr, "Invalid type %d\n", args->type);
#include "dix.h"
#endif
-static char *evt_type[] = { "Event", "Request", "Reply", "Flush" };
-static char *evt_dir[] = { "<====", "---->", "<----", "*****" };
+static char *evt_type[] = { "Event", "Request", "Reply", "Flush", "Error" };
+static char *evt_dir[] = { "<====", "---->", "<----", "*****", "<----"};
static RULE_CHECKER rc = NULL;
_mergeArgs (rule, argc - 2, &(argv[2]));
for (i = 0 ; i < strlen(rule) ; i++)
+ {
+ static int apply = 0;
if(rule[i] == '\"' || rule[i] == '\'')
rule[i] = ' ';
+ if(rule[i] == '+')
+ {
+ rule[i] = ' ';
+ if (apply == 0)
+ strcat(rule, "|| type=reply || type=error");
+ apply = 1;
+ }
+ }
result = rulechecker_add_rule (rc, policy_type, rule);
if (result == RC_ERR_TOO_MANY_RULES)
evlog_name = evinfo->req.name;
else if (evinfo->type == EVENT)
evlog_name = evinfo->evt.name;
+ else if (evinfo ->type == REPLY)
+ evlog_name = evinfo->rep.name;
return rulechecker_validate_rule (rc,
evinfo->type,
ExtensionInfo Evlog_extensions[] = {
- {xDbgEvlogCompositeGetBase, 0, 0, 0, NULL},
- {xDbgEvlogDamageGetBase, 0, 0, 0, NULL},
- {xDbgEvlogDri2GetBase, 0, 0, 0, NULL},
- {xDbgEvlogGestureGetBase, 0, 0, 0, NULL},
- {xDbgEvlogRandrGetBase, 0, 0, 0, NULL},
- {xDbgEvlogXextDpmsGetBase, 0, 0, 0, NULL},
- {xDbgEvlogXextShmGetBase, 0, 0, 0, NULL},
- {xDbgEvlogXextSyncGetBase, 0, 0, 0, NULL},
- {xDbgEvlogXextXtestGetBase, 0, 0, 0, NULL},
- {xDbgEvlogXextXtestExt1GetBase, 0, 0, 0, NULL},
- {xDbgEvlogXvGetBase, 0, 0, 0, NULL}
+ {xDbgEvlogCompositeGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogDamageGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogDri2GetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogGestureGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXinputGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogRandrGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXextDpmsGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXextShmGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXextSyncGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXextXtestGetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXextXtestExt1GetBase, 0, 0, 0, NULL, NULL},
+ {xDbgEvlogXvGetBase, 0, 0, 0, NULL, NULL}
};
ExtensionInfo* Sorted_Evlog_extensions;
int Extensions_size = 0;
RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_dir) / sizeof (char*)));
RETURN_IF_FAIL (evinfo->type >= 0 && (sizeof (evt_type) / sizeof (char*)));
- REPLY ("[%10.3f][%5ld] %22s(%2d:%5d) %s %7s ",
- evinfo->time / 1000.0,
- evinfo->time - prev,
- xDbgEvlogGetCmd (evinfo->client.command),
- evinfo->client.index,
- evinfo->client.pid,
- evt_dir[evinfo->type],
- evt_type[evinfo->type]);
+ if (evinfo->type == REPLY && !evinfo->rep.isStart)
+ {
+ if (on) // detail option is on
+ REPLY ("%67s"," ");
+ else
+ return;
+ }
+ else
+ REPLY ("[%10.3f][%5ld] %22s(%2d:%5d) %s %7s ",
+ evinfo->time / 1000.0,
+ evinfo->time - prev,
+ xDbgEvlogGetCmd (evinfo->client.command),
+ evinfo->client.index,
+ evinfo->client.pid,
+ evt_dir[evinfo->type],
+ evt_type[evinfo->type]);
if (evinfo->type == REQUEST)
{
reply = xDbgEvlogEvent (evinfo, on, reply, len);
REPLY (")");
}
+ else if (evinfo->type == REPLY)
+ {
+ REPLY ("(");
+ reply = xDbgEvlogReply (evinfo, on, reply, len);
+ REPLY (")");
+ }
+ else if (evinfo->type == ERROR)
+ {
+ REPLY("(ErrorCode(0x%02x) resourceID(0x%lx) majorCode(%d) minorCode(%d))",
+ evinfo->err.errorCode,
+ evinfo->err.resourceID,
+ evinfo->err.majorCode,
+ evinfo->err.minorCode);
+ }
else
{
const char *evlog_name = "";
evlog_name = evinfo->req.name;
else if (evinfo->type == EVENT)
evlog_name = evinfo->evt.name;
+ else if (evinfo->type == REPLY)
+ evlog_name = evinfo->rep.name;
REPLY ("(%s)", evlog_name);
}
#include "xdbg_types.h"
#include "xdbg_evlog_request.h"
#include "xdbg_evlog_event.h"
+#include "xdbg_evlog_reply.h"
#include "xdbg_evlog_core.h"
#include "xdbg_evlog_dri2.h"
return reply;
}
+static char *
+_EvlogReplyComposite (EvlogInfo *evinfo, char *reply, int *len)
+{
+#if 0
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+
+ default:
+ break;
+ }
+
+#endif
+ return reply;
+}
void
xDbgEvlogCompositeGetBase (ExtensionInfo *extinfo)
extinfo->req_func = _EvlogRequestComposite;
extinfo->evt_func = _EvlogEventComposite;
+ extinfo->rep_func = _EvlogReplyComposite;
#else
ExtensionEntry *xext = CheckExtension (COMPOSITE_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestComposite;
extinfo->evt_func = _EvlogEventComposite;
+ extinfo->rep_func = _EvlogReplyComposite;
#endif
}
return reply;
}
+ case X_GetProperty:
+ {
+ xGetPropertyReq *stuff = (xGetPropertyReq *)req;
+
+ REPLY (": XID(0x%lx)",
+ stuff->window);
+
+ REPLY (" Property");
+ reply = xDbgGetAtom(stuff->property, evinfo, reply, len);
+ REPLY (" Type");
+ reply = xDbgGetAtom(stuff->type, evinfo, reply, len);
+
+ return reply;
+ }
+
case X_SetSelectionOwner:
{
xSetSelectionOwnerReq *stuff = (xSetSelectionOwnerReq *)req;
return reply;
}
+ case X_ListProperties:
case X_DestroyWindow:
case X_DestroySubwindows:
case X_MapWindow:
return reply;
}
-
char * xDbgEvlogEventCore (EvlogInfo *evinfo, char *reply, int *len)
{
xEvent *evt = evinfo->evt.ptr;
return reply;
}
+
+char * xDbgEvlogReplyCore (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqType)
+ {
+ case X_GetGeometry:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGetGeometryReply *stuff = (xGetGeometryReply *)rep;
+
+ REPLY (": XID(0x%lx) coord(%d,%d %dx%d) borderWidth(%d)",
+ stuff->root,
+ stuff->x,
+ stuff->y,
+ stuff->width,
+ stuff->height,
+ stuff->borderWidth);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_QueryTree:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xQueryTreeReply *stuff = (xQueryTreeReply *)rep;
+
+ REPLY (": XID(0x%lx) Parent(0x%lx) ChildrenNum(%d)",
+ stuff->root,
+ stuff->parent,
+ stuff->nChildren);
+ }
+ else
+ {
+ Window *stuff = (Window *)rep;
+ int i;
+
+ REPLY ("childIDs");
+ REPLY ("(");
+ for (i = 0 ; i < evinfo->rep.size / sizeof(Window) ; i++)
+ {
+ REPLY("0x%lx", stuff[i]);
+ if(i != evinfo->rep.size / sizeof(Window) - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+ }
+
+ return reply;
+ }
+
+ case X_GetProperty:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGetPropertyReply *stuff = (xGetPropertyReply *)rep;
+
+ REPLY (": PropertyType");
+ reply = xDbgGetAtom(stuff->propertyType, evinfo, reply, len);
+
+ REPLY (" bytesAfter(0x%lx) ItemNum(%ld)",
+ stuff->bytesAfter,
+ stuff->nItems);
+ }
+ else
+ {
+ return reply;
+ }
+
+
+ return reply;
+ }
+
+ case X_ListProperties:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xListPropertiesReply *stuff = (xListPropertiesReply *)rep;
+
+ REPLY (" PropertieNum(%d)",
+ stuff->nProperties);
+ }
+ else
+ {
+ Atom *stuff = (Atom *)rep;
+ int i;
+
+ REPLY ("Properties");
+ REPLY ("(");
+ for (i = 0 ; i < evinfo->rep.size / sizeof(Atom) ; i ++)
+ {
+ reply = xDbgGetAtom(stuff[i], evinfo, reply, len);
+ if(i != evinfo->rep.size / sizeof(Atom) - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+ }
+
+
+
+ return reply;
+ }
+
+ case X_GetImage:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGetImageReply *stuff = (xGetImageReply *)rep;
+
+ REPLY (": XID(0x%lx)",
+ stuff->visual);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_GetKeyboardControl:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGetKeyboardControlReply *stuff = (xGetKeyboardControlReply *)rep;
+
+ REPLY (": keyClickPercent(%d) bellPercent(%d), bellPitch(%d) bellDuration(%d)",
+ stuff->keyClickPercent,
+ stuff->bellPercent,
+ stuff->bellPitch,
+ stuff->bellDuration);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_GetPointerControl:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGetPointerControlReply *stuff = (xGetPointerControlReply *)rep;
+
+ REPLY (": accelNumerator(%d) accelDenominator(%d), threshold(%d)",
+ stuff->accelNumerator,
+ stuff->accelDenominator,
+ stuff->threshold);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
#include "xdbg_types.h"
char * xDbgEvlogRequestCore (EvlogInfo *evinfo, char *reply, int *len);
+char * xDbgEvlogReplyCore (EvlogInfo *evinfo, char *reply, int *len);
char * xDbgEvlogEventCore (EvlogInfo *evinfo, char *reply, int *len);
#endif
return reply;
}
+static char *
+_EvlogReplyDamage (EvlogInfo *evinfo, char *reply, int *len)
+{
+#if 0
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+
+ default:
+ break;
+ }
+#endif
+ return reply;
+}
+
void
xDbgEvlogDamageGetBase (ExtensionInfo *extinfo)
{
extinfo->req_func = _EvlogRequestDamage;
extinfo->evt_func = _EvlogEventDamage;
+ extinfo->rep_func = _EvlogReplyDamage;
#else
ExtensionEntry *xext = CheckExtension (DAMAGE_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestDamage;
extinfo->evt_func = _EvlogEventDamage;
+ extinfo->rep_func = _EvlogReplyDamage;
#endif
}
return reply;
}
+static char *
+_EvlogReplyDri2 (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_DRI2GetBuffers:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xDRI2GetBuffersReply *stuff = (xDRI2GetBuffersReply *)rep;
+ REPLY (": size(%ldx%ld) Count(%ld)",
+ stuff->width,
+ stuff->height,
+ stuff->count);
+ }
+ else
+ {
+ xDRI2Buffer *stuff = (xDRI2Buffer *)rep;
+
+ REPLY ("attachment(0x%lx) Name(0x%lx) pitch(0x%lx) cpp(0x%lx)",
+ stuff->attachment,
+ stuff->name,
+ stuff->pitch,
+ stuff->cpp);
+ }
+ return reply;
+ }
+
+ case X_DRI2SwapBuffers:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xDRI2SwapBuffersReply *stuff = (xDRI2SwapBuffersReply *)rep;
+ REPLY (": swap(%ld/%ld)",
+ stuff->swap_hi,
+ stuff->swap_lo);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
void
xDbgEvlogDri2GetBase (ExtensionInfo *extinfo)
extinfo->req_func = _EvlogRequestDri2;
extinfo->evt_func = _EvlogEventDri2;
+ extinfo->rep_func = _EvlogReplyDri2;
#else
ExtensionEntry *xext = CheckExtension (DRI2_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestDri2;
extinfo->evt_func = _EvlogEventDri2;
+ extinfo->rep_func = _EvlogReplyDri2;
#endif
}
return reply;
}
+static char *
+_EvlogReplyGesture (EvlogInfo *evinfo, char *reply, int *len)
+{
+#if 0
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+
+ default:
+ break;
+ }
+#endif
+ return reply;
+}
void
xDbgEvlogGestureGetBase (ExtensionInfo *extinfo)
extinfo->req_func = _EvlogRequestGesture;
extinfo->evt_func = _EvlogEventGesture;
+ extinfo->rep_func = _EvlogReplyGesture;
#else
ExtensionEntry *xext = CheckExtension (GESTURE_EXT_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestGesture;
extinfo->evt_func = _EvlogEventGesture;
+ extinfo->rep_func = _EvlogReplyGesture;
#endif
}
return reply;
}
+static char *
+_EvlogReplyRandr (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_RRGetScreenSizeRange:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xRRGetScreenSizeRangeReply *stuff = (xRRGetScreenSizeRangeReply *)rep;
+ REPLY (": minSize(%dx%d) maxSize(%dx%d)",
+ stuff->minWidth,
+ stuff->minHeight,
+ stuff->maxWidth,
+ stuff->maxHeight);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_RRGetScreenResources:
+ {
+ static int nCrtcs, nOutputs, nModes, nbytesNames;
+
+ if (evinfo->rep.isStart)
+ {
+ xRRGetScreenResourcesReply *stuff = (xRRGetScreenResourcesReply *)rep;
+ REPLY (": Timestamp(%ldms) ConfigTimestamp(%ldms) nCrtcs(%d) nOutputs(%d) nModes(%d) nbytesNames(%d)",
+ stuff->timestamp,
+ stuff->configTimestamp,
+ stuff->nCrtcs,
+ stuff->nOutputs,
+ stuff->nModes,
+ stuff->nbytesNames);
+
+ nCrtcs = stuff->nCrtcs;
+ nOutputs = stuff->nOutputs;
+ nModes = stuff->nModes;
+ nbytesNames = stuff->nbytesNames;
+ }
+ else
+ {
+ RRCrtc *crtcs = (RRCrtc *)rep;
+ RROutput *outputs = (RROutput *)(crtcs + nCrtcs);
+ xRRModeInfo *modeinfos = (xRRModeInfo *)(outputs + nOutputs);
+ CARD8 *names = (CARD8 *)(modeinfos + nModes);
+ char temp[64] = {0, };
+ int i;
+
+ REPLY ("Crtcs");
+ REPLY ("(");
+ for (i = 0 ; i < nCrtcs ; i++)
+ {
+ REPLY ("0x%lx", crtcs[i]);
+ if(i != nCrtcs - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Outputs");
+ REPLY ("(");
+ for (i = 0 ; i < nOutputs ; i++)
+ {
+ REPLY ("0x%lx", outputs[i]);
+ if(i != nOutputs - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Modes");
+ REPLY ("(");
+ for (i = 0 ; i < nModes ; i++)
+ {
+ REPLY ("0x%lx %dx%d", modeinfos[i].id, modeinfos[i].width, modeinfos[i].height);
+ if(i != nModes - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Names");
+
+ strncpy (temp, (char *)names, nbytesNames);
+
+ REPLY ("(");
+ REPLY ("%s", temp);
+ REPLY (")");
+
+ }
+
+ return reply;
+ }
+
+ case X_RRGetOutputInfo:
+ {
+ static int nCrtcs, nModes, nPreferred, nClones;
+ if (evinfo->rep.isStart)
+ {
+ xRRGetOutputInfoReply *stuff = (xRRGetOutputInfoReply *)rep;
+ REPLY (": Timestamp(%ldms) Crtc(0x%lx) mmSize(%ldx%ld) nCrtcs(%d) nModes(%d) nPreferred(%d) nClones(%d)",
+ stuff->timestamp,
+ stuff->crtc,
+ stuff->mmWidth,
+ stuff->mmHeight,
+ stuff->nCrtcs,
+ stuff->nModes,
+ stuff->nPreferred,
+ stuff->nClones);
+
+ nCrtcs = stuff->nCrtcs;
+ nModes = stuff->nModes;
+ nPreferred = stuff->nPreferred;
+ nClones = stuff->nClones;
+ }
+ else
+ {
+ RRCrtc *crtcs = (RRCrtc *) rep;
+ RRMode *modes = (RRMode *) (crtcs + nCrtcs);
+ RROutput *clones = (RROutput *) (modes + nModes);
+ char *name = (char *) (clones + nClones);
+ int i;
+
+ REPLY ("Crtcs");
+ REPLY ("(");
+ for (i = 0 ; i < nCrtcs ; i++)
+ {
+ REPLY ("0x%lx", crtcs[i]);
+ if(i != nCrtcs - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Modes");
+ REPLY ("(");
+ for (i = 0 ; i < nModes ; i++)
+ {
+ REPLY ("0x%lx", modes[i]);
+ if(i != nModes - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Clone");
+ REPLY ("(");
+ for (i = 0 ; i < nClones ; i++)
+ {
+ REPLY ("0x%lx", clones[i]);
+ if(i != nClones - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Name");
+ REPLY ("(");
+ REPLY ("%s", name);
+ REPLY (")");
+ }
+
+ return reply;
+ }
+
+ case X_RRListOutputProperties:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xRRListOutputPropertiesReply *stuff = (xRRListOutputPropertiesReply *)rep;
+ REPLY (": nAtoms(%d)",
+ stuff->nAtoms);
+ }
+ else
+ {
+ Atom *stuff = (Atom *)rep;
+ int i;
+
+ REPLY ("Properties:");
+ for (i = 0 ; i < evinfo->rep.size / sizeof(Atom) ; i++)
+ {
+ reply = xDbgGetAtom(stuff[i], evinfo, reply, len);
+ if(i != evinfo->rep.size / sizeof(Atom) - 1)
+ REPLY (", ");
+ }
+ }
+
+ return reply;
+ }
+
+ case X_RRGetOutputProperty:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xRRGetOutputPropertyReply *stuff = (xRRGetOutputPropertyReply *)rep;
+ REPLY (": Atoms");
+ reply = xDbgGetAtom(stuff->propertyType, evinfo, reply, len);
+
+ REPLY (" bytesAfter(%ld) nItems(%ld)",
+ stuff->bytesAfter,
+ stuff->nItems);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_RRGetCrtcInfo:
+ {
+ static int nOutput, nPossibleOutput;
+
+ if (evinfo->rep.isStart)
+ {
+ xRRGetCrtcInfoReply *stuff = (xRRGetCrtcInfoReply *)rep;
+ REPLY (" Timestamp(%ldms) coord(%d,%d %dx%d) RRmode(0x%lx) rot(%d) rots(%d) nOutput(%d) nPossibleOutput(%d)",
+ stuff->timestamp,
+ stuff->x,
+ stuff->y,
+ stuff->width,
+ stuff->height,
+ stuff->mode,
+ stuff->rotation,
+ stuff->rotations,
+ stuff->nOutput,
+ stuff->nPossibleOutput);
+
+ nOutput = stuff->nOutput;
+ nPossibleOutput = stuff->nPossibleOutput;
+ }
+ else
+ {
+ RROutput *outputs = (RROutput *) rep;
+ RROutput *possible = (RROutput *) (outputs + nOutput);
+ int i;
+
+ REPLY ("Outputs");
+ REPLY ("(");
+ for (i = 0 ; i < nOutput ; i++)
+ {
+ REPLY ("0x%lx", outputs[i]);
+ if(i != nOutput - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Possible");
+ REPLY ("(");
+ for (i = 0 ; i < nPossibleOutput ; i++)
+ {
+ REPLY ("0x%lx", possible[i]);
+ if(i != nPossibleOutput - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+ }
+
+ return reply;
+ }
+
+ case X_RRSetCrtcConfig:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xRRSetCrtcConfigReply *stuff = (xRRSetCrtcConfigReply *)rep;
+
+ REPLY (" newTimestamp(%ldms)",
+ stuff->newTimestamp);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_RRGetScreenResourcesCurrent:
+ {
+ static int nCrtcs, nOutputs, nModes, nbytesNames;
+
+ if (evinfo->rep.isStart)
+ {
+ xRRGetScreenResourcesReply *stuff = (xRRGetScreenResourcesReply *)rep;
+
+ REPLY (" Timestamp(%ldms) ConfigTimestamp(%ldms) nCrtcs(%d) nOutputs(%d) nModes(%d) nbytesNames(%d)",
+ stuff->timestamp,
+ stuff->configTimestamp,
+ stuff->nCrtcs,
+ stuff->nOutputs,
+ stuff->nModes,
+ stuff->nbytesNames);
+
+ nCrtcs = stuff->nCrtcs;
+ nOutputs = stuff->nOutputs;
+ nModes = stuff->nModes;
+ nbytesNames = stuff->nbytesNames;
+ }
+ else
+ {
+ RRCrtc *crtcs = (RRCrtc *)rep;
+ RROutput *outputs = (RROutput *)(crtcs + nCrtcs);
+ xRRModeInfo *modeinfos = (xRRModeInfo *)(outputs + nOutputs);
+ CARD8 *names = (CARD8 *)(modeinfos + nModes);
+ char temp[64] = {0, };
+ int i;
+
+ REPLY ("Crtcs");
+ REPLY ("(");
+ for (i = 0 ; i < nCrtcs ; i++)
+ {
+ REPLY ("0x%lx", crtcs[i]);
+ if(i != nCrtcs - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Outputs");
+ REPLY ("(");
+ for (i = 0 ; i < nOutputs ; i++)
+ {
+ REPLY ("0x%lx", outputs[i]);
+ if(i != nOutputs - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Modes");
+ REPLY ("(");
+ for (i = 0 ; i < nModes ; i++)
+ {
+ REPLY ("0x%lx %dx%d", modeinfos[i].id, modeinfos[i].width, modeinfos[i].height);
+ if(i != nModes - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+
+ REPLY (" Names");
+
+ strncpy (temp, (char *)names, nbytesNames);
+
+ REPLY ("(");
+ REPLY ("%s", temp);
+ REPLY (")");
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
void
xDbgEvlogRandrGetBase (ExtensionInfo *extinfo)
extinfo->req_func = _EvlogRequestRandr;
extinfo->evt_func = _EvlogEventRandr;
+ extinfo->rep_func = _EvlogReplyRandr;
#else
ExtensionEntry *xext = CheckExtension (RANDR_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestRandr;
extinfo->evt_func = _EvlogEventRandr;
+ extinfo->rep_func = _EvlogReplyRandr;
#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.
+
+**************************************************************************/
+
+#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 <sys/shm.h>
+
+#include "xdbg_types.h"
+#include "xdbg_evlog.h"
+#include "xdbg_evlog_reply.h"
+
+#define UNKNOWN_EVENT "<unknown>"
+
+char *
+xDbgEvlogReply (EvlogInfo *evinfo, Bool on, char *reply, int *len)
+{
+ extern ExtensionInfo Evlog_extensions[];
+ extern int Extensions_size;
+ EvlogReply rep;
+ xGenericReply *xRep = NULL;
+ int i;
+
+ RETURN_VAL_IF_FAIL (evinfo != NULL, reply);
+ RETURN_VAL_IF_FAIL (evinfo->type == REPLY, reply);
+
+ rep = evinfo->rep;
+ xRep = rep.ptr;
+
+ if (rep.isStart)
+ REPLY ("%s", evinfo->rep.name);
+
+ if(!on)
+ return reply;
+
+ if (rep.reqType < EXTENSION_BASE)
+ {
+ return xDbgEvlogReplyCore (evinfo, reply, len);
+ }
+ else
+ {
+ for (i = 0 ; i < Extensions_size ; i++)
+ {
+ if (rep.reqType == Evlog_extensions[i].opcode)
+ {
+ return Evlog_extensions[i].rep_func (evinfo, reply, len);
+ }
+ }
+ }
+
+ return reply;
+}
--- /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_REPLY_H__
+#define __XDBG_EVLOG_REPLY_H__
+
+#include "xdbg_types.h"
+
+char * xDbgEvlogReply (EvlogInfo *evinfo, Bool on, char *reply, int *len);
+
+#endif
return reply;
}
+
+static char *
+_EvlogReplyXextDpms (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_DPMSSetTimeouts:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xDPMSGetTimeoutsReply *stuff = (xDPMSGetTimeoutsReply *)rep;
+ REPLY (": Standby(%d) Suspend(%d) off(%d)",
+ stuff->standby,
+ stuff->suspend,
+ stuff->off);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
+static char *
+_EvlogReplyXextShm (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_ShmGetImage:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xShmGetImageReply *stuff = (xShmGetImageReply *)rep;
+ REPLY (": Visual(0x%lx) size(%ld)",
+ stuff->visual,
+ stuff->size);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
+static char *
+_EvlogReplyXextSync (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_SyncQueryCounter:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xSyncQueryCounterReply *stuff = (xSyncQueryCounterReply *)rep;
+ REPLY (": Value(0x%lx/0x%lx)",
+ stuff->value_hi,
+ stuff->value_lo);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
+static char *
+_EvlogReplyXextXtestExt1 (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_TestQueryInputSize:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xTestQueryInputSizeReply *stuff = (xTestQueryInputSizeReply *)rep;
+ REPLY (": sizeReturn(0x%lx)",
+ stuff->size_return);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
+static char *
+_EvlogReplyXextXtest (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_XTestGetVersion:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXTestGetVersionReply *stuff = (xXTestGetVersionReply *)rep;
+ REPLY (": MinorVersion(%d)",
+ stuff->minorVersion);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
void
xDbgEvlogXextDpmsGetBase (ExtensionInfo *extinfo)
{
extinfo->req_func = _EvlogRequestXextDpms;
extinfo->evt_func = _EvlogEventXextDpms;
+ extinfo->rep_func = _EvlogReplyXextDpms;
#else
ExtensionEntry *xext = CheckExtension (DPMSExtensionName);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXextDpms;
extinfo->evt_func = _EvlogEventXextDpms;
+ extinfo->rep_func = _EvlogReplyXextDpms;
#endif
}
extinfo->req_func = _EvlogRequestXextShm;
extinfo->evt_func = _EvlogEventXextShm;
+ extinfo->rep_func = _EvlogReplyXextShm;
#else
ExtensionEntry *xext = CheckExtension (SHMNAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXextShm;
extinfo->evt_func = _EvlogEventXextShm;
+ extinfo->rep_func = _EvlogReplyXextShm;
#endif
}
extinfo->req_func = _EvlogRequestXextSync;
extinfo->evt_func = _EvlogEventXextSync;
+ extinfo->rep_func = _EvlogReplyXextSync;
#else
ExtensionEntry *xext = CheckExtension (SYNC_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXextSync;
extinfo->evt_func = _EvlogEventXextSync;
+ extinfo->rep_func = _EvlogReplyXextSync;
#endif
}
extinfo->req_func = _EvlogRequestXextXtestExt1;
extinfo->evt_func = _EvlogEventXextXtestExt1;
+ extinfo->rep_func = _EvlogReplyXextXtestExt1;
#else
ExtensionEntry *xext = CheckExtension (XTestEXTENSION_NAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXextXtestExt1;
extinfo->evt_func = _EvlogEventXextXtestExt1;
+ extinfo->rep_func = _EvlogReplyXextXtestExt1;
#endif
}
extinfo->req_func = _EvlogRequestXextXtest;
extinfo->evt_func = _EvlogEventXextXtest;
+ extinfo->rep_func = _EvlogReplyXextXtest;
#else
ExtensionEntry *xext = CheckExtension (XTestExtensionName);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXextXtest;
extinfo->evt_func = _EvlogEventXextXtest;
+ extinfo->rep_func = _EvlogReplyXextXtest;
#endif
}
case XI_DeviceKeyPress:
{
XDeviceKeyPressedEvent *stuff = (XDeviceKeyPressedEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
case XI_DeviceKeyRelease:
{
XDeviceKeyReleasedEvent *stuff = (XDeviceKeyReleasedEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
case XI_DeviceButtonPress:
{
XDeviceButtonPressedEvent *stuff = (XDeviceButtonPressedEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
case XI_DeviceButtonRelease:
{
XDeviceButtonReleasedEvent *stuff = (XDeviceButtonReleasedEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
case XI_DeviceMotionNotify:
{
XDeviceMotionEvent *stuff = (XDeviceMotionEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
case XI_ProximityIn:
{
XProximityInEvent *stuff = (XProximityInEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
case XI_ProximityOut:
{
XProximityOutEvent *stuff = (XProximityOutEvent *) evt;
- REPLY (": XID(0x%lx) Window(0x%lx %d,%d) Root(0x%lx %d,%d) subWindow(0x%lx)",
+ REPLY (": XID(0x%lx) Window(0x%lx) Root(0x%lx) subWindow(0x%lx)",
stuff->deviceid,
stuff->window,
- stuff->x,
- stuff->y,
stuff->root,
- stuff->x_root,
- stuff->y_root,
stuff->subwindow);
return reply;
return reply;
}
+static char *
+_EvlogReplyXinput (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case X_ListInputDevices:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xListInputDevicesReply *stuff = (xListInputDevicesReply *) rep;
+ REPLY (": nDevices(%d)",
+ stuff->ndevices);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_GrabDevice:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGrabDeviceReply *stuff = (xGrabDeviceReply *) rep;
+ REPLY (": status(%d)",
+ stuff->status);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_GetDeviceFocus:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xGetDeviceFocusReply *stuff = (xGetDeviceFocusReply *) rep;
+ REPLY (": XID(0x%lx) Time(0x%lx)",
+ stuff->focus,
+ stuff->time);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIQueryVersion:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIQueryVersionReply *stuff = (xXIQueryVersionReply *) rep;
+ REPLY (": majorVersion(%d) minorVersion(%d)",
+ stuff->major_version,
+ stuff->minor_version);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIQueryDevice:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIQueryDeviceReply *stuff = (xXIQueryDeviceReply *) rep;
+ REPLY (": numDevices(%d)",
+ stuff->num_devices);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIGetSelectedEvents:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIGetSelectedEventsReply *stuff = (xXIGetSelectedEventsReply *) rep;
+ REPLY (": numMasks(%d)",
+ stuff->num_masks);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIQueryPointer:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIQueryPointerReply *stuff = (xXIQueryPointerReply *) rep;
+ REPLY (": XID(0x%x) Child(0x%x) root(%d,%d) win(%d,%d)",
+ stuff->root,
+ stuff->child,
+ stuff->root_x,
+ stuff->root_y,
+ stuff->win_x,
+ stuff->win_y);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIGetClientPointer:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIGetClientPointerReply *stuff = (xXIGetClientPointerReply *) rep;
+ REPLY (": Set(%s) deviceid(%d)",
+ (stuff->set) ? "true":"false",
+ stuff->deviceid);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIGetFocus:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIGetFocusReply *stuff = (xXIGetFocusReply *) rep;
+ REPLY (": XID(0x%x)",
+ stuff->focus);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIGrabDevice:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIGrabDeviceReply *stuff = (xXIGrabDeviceReply *) rep;
+ REPLY (": status(%d)",
+ stuff->status);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIPassiveGrabDevice:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIPassiveGrabDeviceReply *stuff = (xXIPassiveGrabDeviceReply *) rep;
+ REPLY (": numModifiers(%d)",
+ stuff->num_modifiers);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ case X_XIListProperties:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIListPropertiesReply *stuff = (xXIListPropertiesReply *) rep;
+ REPLY (": numProperties(%d)",
+ stuff->num_properties);
+ }
+ else
+ {
+ Atom *stuff = (Atom *)rep;
+ int i;
+
+ REPLY ("Properties(");
+ for (i = 0 ; i < evinfo->rep.size / sizeof(Atom) ; i ++)
+ {
+ reply = xDbgGetAtom(stuff[i], evinfo, reply, len);
+ if(i != evinfo->rep.size / sizeof(Atom) - 1)
+ REPLY (", ");
+ }
+ REPLY (")");
+ }
+
+ return reply;
+ }
+
+ case X_XIGetProperty:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xXIGetPropertyReply *stuff = (xXIGetPropertyReply *) rep;
+
+ REPLY (": Type");
+ xDbgGetAtom(stuff->type, evinfo, reply, len);
+
+ REPLY (" numItems(%d) format(%d)",
+ stuff->num_items,
+ stuff->format);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
void
xDbgEvlogXinputGetBase (ExtensionInfo *extinfo)
{
extinfo->req_func = _EvlogRequestXinput;
extinfo->evt_func = _EvlogEventXinput;
+ extinfo->rep_func = _EvlogReplyXinput;
#else
ExtensionEntry *xext = CheckExtension (INAME);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXinput;
extinfo->evt_func = _EvlogEventXinput;
+ extinfo->rep_func = _EvlogReplyXinput;
#endif
}
return reply;
}
+static char *
+_EvlogReplyXv (EvlogInfo *evinfo, char *reply, int *len)
+{
+ xGenericReply *rep = evinfo->rep.ptr;
+
+ switch (evinfo->rep.reqData)
+ {
+ case xv_QueryBestSize:
+ {
+ if (evinfo->rep.isStart)
+ {
+ xvQueryBestSizeReply *stuff = (xvQueryBestSizeReply *)rep;
+ REPLY (": actualSize(%dx%d)",
+ stuff->actual_width,
+ stuff->actual_height);
+ }
+ else
+ {
+ return reply;
+ }
+
+ return reply;
+ }
+
+ default:
+ break;
+ }
+
+ return reply;
+}
+
void
xDbgEvlogXvGetBase (ExtensionInfo *extinfo)
{
extinfo->req_func = _EvlogRequestXv;
extinfo->evt_func = _EvlogEventXv;
+ extinfo->rep_func = _EvlogReplyXv;
#else
ExtensionEntry *xext = CheckExtension (XvName);
RETURN_IF_FAIL (xext != NULL);
extinfo->err_base = xext->errorBase;
extinfo->req_func = _EvlogRequestXv;
extinfo->evt_func = _EvlogEventXv;
+ extinfo->rep_func = _EvlogReplyXv;
#endif
}
EVENT,
REQUEST,
REPLY,
- FLUSH
+ FLUSH,
+ ERROR
} EvlogType;
#define EVLOG_MASK_CLIENT (1<<0)
#define EVLOG_MASK_REQUEST (1<<1)
#define EVLOG_MASK_EVENT (1<<2)
-#define EVLOG_MASK_ATOM (1<<3)
-#define EVLOG_MASK_REGION (1<<4)
+#define EVLOG_MASK_REPLY (1<<3)
+#define EVLOG_MASK_ERROR (1<<4)
+#define EVLOG_MASK_ATOM (1<<5)
+#define EVLOG_MASK_REGION (1<<6)
typedef struct _EvlogTable
char name[PATH_MAX+1];
} EvlogEvent;
+typedef struct _EvlogReply
+{
+ xGenericReply *ptr;
+ int size;
+ char name[PATH_MAX+1];
+ int reqType;
+ int reqData;
+ Bool isStart;
+} EvlogReply;
+
+typedef struct _EvlogError
+{
+ BYTE errorCode;
+ CARD32 resourceID;
+ CARD16 minorCode;
+ CARD8 majorCode;
+} EvlogError;
+
typedef struct _EvlogInfo
{
EvlogType type;
EvlogClient client;
EvlogRequest req;
EvlogEvent evt;
+ EvlogReply rep;
+ EvlogError err;
EvlogAtom evatom;
EvlogRegion evregion;
int err_base;
char* (*req_func) (EvlogInfo *evinfo, char *reply, int *len);
char* (*evt_func) (EvlogInfo *evinfo, int first_base, char *reply, int *len);
+ char* (*rep_func) (EvlogInfo *evinfo, char *reply, int *len);
};
#endif
pMod->evlog_path = strdup (argv[2]);
- if (pMod->evlog_path[0] == '/')
+ if (!strcmp (pMod->evlog_path, "console"))
+ XDBG_REPLY ("/proc/%d/fd/1", pid);
+ else if (pMod->evlog_path[0] == '/')
XDBG_REPLY ("evlog path: %s\n", pMod->evlog_path);
else
XDBG_REPLY ("evlog path: %s/%s\n", pMod->cwd, pMod->evlog_path);
if (evinfo->mask & EVLOG_MASK_EVENT)
write_len += (sizeof (EvlogEvent) + evinfo->evt.size);
+ if (evinfo->mask & EVLOG_MASK_REPLY)
+ write_len += (sizeof (EvlogReply) + evinfo->rep.size);
+
+ if (evinfo->mask & EVLOG_MASK_ERROR)
+ write_len += (sizeof (EvlogError));
+
if (evinfo->mask & EVLOG_MASK_ATOM)
write_len += (sizeof (int) +
(sizeof (EvlogAtomTable) * evinfo->evatom.size));
return;
}
}
+ if (evinfo->mask & EVLOG_MASK_REPLY)
+ {
+ if (write (fd, &evinfo->rep, sizeof (EvlogReply)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write reply\n");
+ return;
+ }
+
+ XDBG_WARNING_IF_FAIL (evinfo->rep.size > 0);
+ if (write (fd, evinfo->rep.ptr, evinfo->rep.size) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write reply\n");
+ return;
+ }
+ }
+ if (evinfo->mask & EVLOG_MASK_ERROR)
+ {
+ if (write (fd, &evinfo->err, sizeof (EvlogError)) == -1)
+ {
+ XDBG_ERROR (MXDBG, "failed: write reply\n");
+ return;
+ }
+ }
if (evinfo->mask & EVLOG_MASK_ATOM)
{
dprintf (fd, "%s", log);
}
-static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev)
+static void evtPrint (EvlogType type, ClientPtr client, xEvent *ev, ReplyInfoRec *rep)
{
EvlogInfo evinfo = {0,};
static int EntryInit = 0;
LookupRequestName (stuff->reqType, stuff->data));
}
}
+
+ /* evinfo.rep */
+ if (type == REPLY)
+ {
+ REQUEST (xReq);
+
+ evinfo.mask |= EVLOG_MASK_REPLY;
+ evinfo.rep.reqType = stuff->reqType;
+ evinfo.rep.reqData = stuff->data;
+ evinfo.rep.ptr = (xGenericReply*)rep->replyData;
+ evinfo.rep.size = rep->dataLenBytes - rep->padBytes;
+ evinfo.rep.isStart = rep->startOfReply;
+
+ if (stuff->reqType < EXTENSION_BASE)
+ snprintf (evinfo.rep.name, sizeof (evinfo.rep.name), "%s",
+ LookupRequestName (stuff->reqType, 0));
+ else
+ snprintf (evinfo.rep.name, sizeof (evinfo.rep.name), "%s",
+ LookupRequestName (stuff->reqType, stuff->data));
+ }
+
+ if (type == ERROR)
+ {
+ xError* err = NULL;
+
+ if (ev)
+ err = (xError *) ev;
+ else if (rep)
+ err = (xError *) rep->replyData;
+
+ evinfo.mask |= EVLOG_MASK_ERROR;
+ evinfo.err.errorCode = err->errorCode;
+ evinfo.err.resourceID = err->resourceID;
+ evinfo.err.minorCode = err->minorCode;
+ evinfo.err.majorCode = err->majorCode;
+ }
}
/* evinfo.evt */
if (ev)
{
- XDBG_RETURN_IF_FAIL (type == EVENT);
-
- evinfo.mask |= EVLOG_MASK_EVENT;
- evinfo.evt.ptr = ev;
- snprintf (evinfo.evt.name, sizeof (evinfo.evt.name), "%s",
- LookupEventName ((int)(ev->u.u.type)));
+ if (type == EVENT)
+ {
+ evinfo.mask |= EVLOG_MASK_EVENT;
+ evinfo.evt.ptr = ev;
+ snprintf (evinfo.evt.name, sizeof (evinfo.evt.name), "%s",
+ LookupEventName ((int)(ev->u.u.type)));
+ }
}
/* evinfo.time */
if (xev_trace_on == FALSE)
return;
- evtPrint (FLUSH, NULL, NULL);
+ evtPrint (FLUSH, NULL, NULL, NULL);
}
static void
ReplyInfoRec *pri = (ReplyInfoRec*)calldata;
- evtPrint (REPLY, pri->client, NULL);
+ evtPrint (REPLY, pri->client, NULL, pri);
}
static void
}
}
- if (xev_trace_on)
- evtPrint (EVENT, pClient, pev);
+ 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);
}
}
XDBG_RETURN_IF_FAIL (rec != NULL);
- evtPrint (REQUEST, rec->client, NULL);
+ evtPrint (REQUEST, rec->client, NULL, NULL);
}
static void
if (xev_trace_on == FALSE)
return;
- evtPrint (REQUEST, rec->client, NULL);
+ evtPrint (REQUEST, rec->client, NULL, NULL);
+}
+
+static void
+_traceAuditEndEvents (CallbackListPtr *pcbl, pointer unused, pointer calldata)
+{
+ return;
}
static void
ret &= AddCallback (&FlushCallback, _traceFlush, NULL);
ret &= AddCallback (&ReplyCallback, _traceAReply, NULL);
ret &= XaceRegisterCallback (XACE_CORE_DISPATCH, _traceACoreEvents, NULL);
+ ret &= XaceRegisterCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
+ ret &= XaceRegisterCallback (XACE_AUDIT_END, _traceAuditEndEvents, NULL);
if (!ret)
{
DeleteCallback (&FlushCallback, _traceFlush, NULL);
DeleteCallback (&ReplyCallback, _traceAReply, NULL);
XaceDeleteCallback (XACE_CORE_DISPATCH, _traceACoreEvents, NULL);
+ XaceDeleteCallback (XACE_EXT_DISPATCH, _traceAExtEvents, NULL);
+ XaceDeleteCallback (XACE_AUDIT_END, _traceAuditEndEvents, NULL);
}
return;