mirror of
https://github.com/0intro/wmii
synced 2024-11-21 21:31:33 +03:00
Add 9p debugging.
This commit is contained in:
parent
0e6b2f7025
commit
59bf7023dd
@ -30,6 +30,7 @@ OBJ = area \
|
||||
map \
|
||||
message \
|
||||
mouse \
|
||||
print \
|
||||
root \
|
||||
rule \
|
||||
printevent\
|
||||
|
@ -99,13 +99,14 @@ enum Protocols {
|
||||
};
|
||||
|
||||
enum DebugOpt {
|
||||
DDnd = 1<<0,
|
||||
DEvent = 1<<1,
|
||||
DEwmh = 1<<2,
|
||||
DFocus = 1<<3,
|
||||
DGeneric= 1<<4,
|
||||
DStack = 1<<5,
|
||||
NDebugOpt = 6,
|
||||
D9p = 1<<0,
|
||||
DDnd = 1<<1,
|
||||
DEvent = 1<<2,
|
||||
DEwmh = 1<<3,
|
||||
DFocus = 1<<4,
|
||||
DGeneric= 1<<5,
|
||||
DStack = 1<<6,
|
||||
NDebugOpt = 7,
|
||||
};
|
||||
|
||||
/* Data Structures */
|
||||
|
@ -250,6 +250,9 @@ bool readmotion(Point*);
|
||||
int readmouse(Point*, uint*);
|
||||
Align snap_rect(const Rectangle *rects, int num, Rectangle *current, Align *mask, int snapw);
|
||||
|
||||
/* print.c */
|
||||
int Ffmt(Fmt*);
|
||||
|
||||
/* printevent.c */
|
||||
void printevent(XEvent*);
|
||||
|
||||
|
@ -327,6 +327,11 @@ closedisplay(IxpConn *c) {
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
|
||||
static void
|
||||
printfcall(IxpFcall *f) {
|
||||
Dprint(D9p, "%F\n", f);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
IxpMsg m;
|
||||
@ -383,6 +388,9 @@ extern int fmtevent(Fmt*);
|
||||
|
||||
init_environment();
|
||||
|
||||
fmtinstall('F', Ffmt);
|
||||
ixp_printfcall = printfcall;
|
||||
|
||||
sock = ixp_announce(address);
|
||||
if(sock < 0)
|
||||
fatal("Can't create socket '%s': %r", address);
|
||||
|
@ -95,6 +95,7 @@ char *symtab[] = {
|
||||
};
|
||||
|
||||
char* debugtab[] = {
|
||||
"9p",
|
||||
"dnd",
|
||||
"event",
|
||||
"ewmh",
|
||||
|
124
cmd/wmii/print.c
Normal file
124
cmd/wmii/print.c
Normal file
@ -0,0 +1,124 @@
|
||||
#include "dat.h"
|
||||
#include <fmt.h>
|
||||
#include "fns.h"
|
||||
|
||||
static char* fcnames[] = {
|
||||
"TVersion",
|
||||
"RVersion",
|
||||
"TAuth",
|
||||
"RAuth",
|
||||
"TAttach",
|
||||
"RAttach",
|
||||
"TError",
|
||||
"RError",
|
||||
"TFlush",
|
||||
"RFlush",
|
||||
"TWalk",
|
||||
"RWalk",
|
||||
"TOpen",
|
||||
"ROpen",
|
||||
"TCreate",
|
||||
"RCreate",
|
||||
"TRead",
|
||||
"RRead",
|
||||
"TWrite",
|
||||
"RWrite",
|
||||
"TClunk",
|
||||
"RClunk",
|
||||
"TRemove",
|
||||
"RRemove",
|
||||
"TStat",
|
||||
"RStat",
|
||||
"TWStat",
|
||||
"RWStat",
|
||||
};
|
||||
|
||||
static int
|
||||
qid(Fmt *f, Qid *q) {
|
||||
return fmtprint(f, "(%uhd,%uld,%ullx)", q->type, q->version, q->path);
|
||||
}
|
||||
|
||||
int
|
||||
Ffmt(Fmt *f) {
|
||||
Fcall *fcall;
|
||||
|
||||
fcall = va_arg(f->args, Fcall*);
|
||||
fmtprint(f, "% 2d %s\t", fcall->hdr.tag, fcnames[fcall->hdr.type - TVersion]);
|
||||
switch(fcall->hdr.type) {
|
||||
case TVersion:
|
||||
case RVersion:
|
||||
fmtprint(f, " msize: %uld version: \"%s\"", (ulong)fcall->version.msize, fcall->version.version);
|
||||
break;
|
||||
case TAuth:
|
||||
fmtprint(f, " afid: %uld uname: \"%s\" aname: \"%s\"", (ulong)fcall->tauth.afid, fcall->tauth.uname, fcall->tauth.aname);
|
||||
break;
|
||||
case RAuth:
|
||||
fmtprint(f, " aqid: ");
|
||||
qid(f, &fcall->rauth.aqid);
|
||||
break;
|
||||
case RAttach:
|
||||
fmtprint(f, " qid: ");
|
||||
qid(f, &fcall->rattach.qid);
|
||||
break;
|
||||
case TAttach:
|
||||
fmtprint(f, " fid: %uld afid: %uld uname: \"%s\" aname: \"%s\"", (ulong)fcall->hdr.fid, (ulong)fcall->tattach.afid, fcall->tattach.uname, fcall->tattach.aname);
|
||||
break;
|
||||
case RError:
|
||||
fmtprint(f, " \"%s\"", fcall->error.ename);
|
||||
break;
|
||||
case TFlush:
|
||||
fmtprint(f, " oldtag: %uld", (ulong)fcall->tflush.oldtag);
|
||||
break;
|
||||
case TWalk:
|
||||
fmtprint(f, " newfid: %uld wname: {", (ulong)fcall->twalk.newfid);
|
||||
for(int i=0; i<fcall->twalk.nwname; i++) {
|
||||
if(i > 0) fmtprint(f, ", ");
|
||||
fmtprint(f, "\"%s\"", fcall->twalk.wname[i]);
|
||||
}
|
||||
fmtprint(f, "}");
|
||||
break;
|
||||
case RWalk:
|
||||
fmtprint(f, " wqid: {");
|
||||
for(int i=0; i<fcall->rwalk.nwqid; i++) {
|
||||
if(i > 0) fmtprint(f, ", ");
|
||||
qid(f, &fcall->rwalk.wqid[i]);
|
||||
}
|
||||
fmtprint(f, "}");
|
||||
break;
|
||||
case TOpen:
|
||||
fmtprint(f, " fid: %uld mode: %ulo", (ulong)fcall->hdr.fid, (ulong)fcall->topen.mode);
|
||||
break;
|
||||
case ROpen:
|
||||
case RCreate:
|
||||
fmtprint(f, " qid: ");
|
||||
qid(f, &fcall->ropen.qid);
|
||||
fmtprint(f, " %uld", (ulong)fcall->ropen.iounit);
|
||||
break;
|
||||
case TCreate:
|
||||
fmtprint(f, " fid: %uld name: \"%s\" perm: %ulo mode: %ulo", (ulong)fcall->hdr.fid, fcall->tcreate.name, (ulong)fcall->tcreate.perm, (ulong)fcall->tcreate.mode);
|
||||
break;
|
||||
case TRead:
|
||||
fmtprint(f, " fid: %uld offset: %ulld count: %uld", (ulong)fcall->hdr.fid, fcall->tread.offset, (ulong)fcall->tread.count);
|
||||
break;
|
||||
case RRead:
|
||||
fmtprint(f, " data: {data: %uld}", fcall->rread.count);
|
||||
break;
|
||||
case TWrite:
|
||||
fmtprint(f, " fid: %uld offset: %ulld data: {data: %uld}", (ulong)fcall->hdr.fid, fcall->twrite.offset, fcall->twrite.count);
|
||||
break;
|
||||
case RWrite:
|
||||
fmtprint(f, " count: %uld", (ulong)fcall->rwrite.count);
|
||||
break;
|
||||
case TClunk:
|
||||
case TRemove:
|
||||
case TStat:
|
||||
fmtprint(f, " fid: %uld", (ulong)fcall->hdr.fid);
|
||||
break;
|
||||
case RStat:
|
||||
fmtprint(f, " stat: {data: %uld}", fcall->rstat.nstat);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user