99 lines
8.8 KiB
Groff
99 lines
8.8 KiB
Groff
.\" xtruss version 20211025.c25bf48
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.TH "xtruss" "1" "2009\(hy05\(hy02" "PuTTY\ spinoffs" "PuTTY\ spinoffs"
|
|
.SH "NAME"
|
|
.PP
|
|
\fBxtruss\fP - trace X protocol exchanges, in the manner of \fBstrace\fP
|
|
.SH "SYNOPSIS"
|
|
.PP
|
|
.nf
|
|
\fBxtruss\fP\ [\ \fIoptions\fP\ ]\ \fIcommand\fP\ [\ \fIcommand\-arguments\fP\ ]
|
|
\fBxtruss\fP\ [\ \fIoptions\fP\ ]\ \fB\-p\fP\ \fIX\-resource\-ID\fP
|
|
\fBxtruss\fP\ [\ \fIoptions\fP\ ]\ \fB\-p\fP\ \fB\-\fP
|
|
\fBxtruss\fP\ [\ \fIoptions\fP\ ]\ \fB\-P\fP
|
|
.fi
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
\fBxtruss\fP is a utility which logs everything that passes between the X server and one or more X client programs. In this it is similar to \fBxmon\fP(1), but intended to combine \fBxmon\fP\*(Aqs basic functionality with an interface much more similar to \fBstrace\fP(1).
|
|
.PP
|
|
Like \fBxmon\fP, \fBxtruss\fP in its default mode works by setting up a proxy X server, waiting for connections to that, and forwarding them on to the real X server. However, unlike \fBxmon\fP, you don\*(Aqt have to deal with any of that by hand: there\*(Aqs no need to start the trace utility in one terminal and manually attach processes to it from another, unless you really want to (in which case the \fB-P\fP option will do that). The principal mode of use is just to type \fBxtruss\fP followed by the command line of your X program; \fBxtruss\fP will automatically take care of adjusting the new program\*(Aqs environment to point at its proxy server, and (also unlike \fBxmon\fP) it will also take care of X authorisation automatically.
|
|
.PP
|
|
As an alternative mode of use, you can also attach \fBxtruss\fP to an already-running X application, if you didn\*(Aqt realise you were going to want to trace it until it had already been started. This mode requires cooperation from the X server - specifically, it can\*(Aqt work unless the server supports the \fBRECORD\fP protocol extension - but since modern X.Org servers do provide that, it\*(Aqs often useful.
|
|
.PP
|
|
The logging format of \fBxtruss\fP is much more compact than that of \fBxmon\fP, and resembles \fBstrace\fP in that it\*(Aqs written to look like a series of function calls some of which return values. For instance, where \fBxmon\fP would print
|
|
.PP
|
|
.nf
|
|
\ \ \ \ \ \ \ \ \ ............REQUEST:\ GetSelectionOwner
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ sequence\ number:\ 000f
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ request\ length:\ 0002
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ selection:\ <PRIMARY>
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ..............REPLY:\ GetSelectionOwner
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sequence\ number:\ 000f
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ reply\ length:\ 00000000
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ owner:\ WIN\ 02c0002b
|
|
\ \ \ \ \ \ \ \ \ ............REQUEST:\ InternAtom
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ sequence\ number:\ 0010
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ only\-if\-exists:\ False
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ request\ length:\ 0005
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ length\ of\ name:\ 000c
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ name:\ "VT_SELECTION"
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ..............REPLY:\ InternAtom
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sequence\ number:\ 0010
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ reply\ length:\ 00000000
|
|
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ atom:\ ATM\ 000002bf
|
|
.fi
|
|
.PP
|
|
\fBxtruss\fP will instead print
|
|
.PP
|
|
.nf
|
|
GetSelectionOwner(selection=a#1)\ =\ {owner=w#02C0002B}
|
|
InternAtom(name="VT_SELECTION",\ only\-if\-exists=False)\ =\ {atom=a#703}
|
|
.fi
|
|
.PP
|
|
Note that not only has each request been condensed on to one line (though most lines will be long enough to wrap, at least on a standard 80-column terminal), but also each request and reply have been printed on the \fIsame\fP line.
|
|
.PP
|
|
That last is not always possible, of course: sometimes an application will queue multiple requests before receiving the reply to the first one (in fact, this is generally good behaviour since it minimises network round-trip delays), in which case \fBxtruss\fP\*(Aqs output will look - again mimicking \fBstrace\fP - something like this:
|
|
.PP
|
|
.nf
|
|
InternAtom(name="TARGETS",\ only\-if\-exists=False)\ =\ <unfinished>
|
|
InternAtom(name="TIMESTAMP",\ only\-if\-exists=False)\ =\ <unfinished>
|
|
\ ...\ InternAtom(name="TARGETS",\ only\-if\-exists=False)\ =\ {atom=a#378}
|
|
\ ...\ InternAtom(name="TIMESTAMP",\ only\-if\-exists=False)\ =\ {atom=a#379}
|
|
.fi
|
|
.SH "OPTIONS"
|
|
.PP
|
|
These options change the mode of operation of \fBxtruss\fP away from the default of acting as a wrapper on a single command:
|
|
.IP "\fB-p\fP \fIresource-ID\fP"
|
|
Attach to the X client owning the given resource, using the X \fBRECORD\fP extension (which the server must support for this to work). The resource ID can be a decimal integer or a hex integer preceded with `\fB0x\fP'. It typically names an X window, but can name another type of resource instead (e.g. a pixmap or cursor) or just specify the resource base of the client connection. If you don\*(Aqt know any of those things, you can give the resource ID as just `\fB-\fP', in which case \fBxtruss\fP will allow you to interactively select a window by clicking with the mouse (similarly to \fBxkill\fP(1), \fBxwininfo\fP(1) and \fBxprop\fP(1)) and will trace the client that owns the window you select.
|
|
.IP "\fB-P\fP"
|
|
Set up a logging X proxy as in the normal mode, but instead of spawning a subprocess to connect to that proxy, just wait for connections. This turns \fBxtruss\fP into a tool more similar to \fBxmon\fP: you start it in one terminal window, and then from another terminal window you can configure selected processes to connect to the proxy server and be logged. \fBxtruss\fP will print on standard output the environment variables you need to set up to connect other processes to the proxy (in both \fBsh\fP and \fBcsh\fP syntax).
|
|
.PP
|
|
The following options apply to all modes of operation:
|
|
.IP "\fB-s\fP \fIlength\fP"
|
|
Limit the length of output lines by eliding most of the contents of long arrays, strings and blocks of data. \fBxtruss\fP will begin to shorten lines at the specified length (any line shorter than that should not be interfered with), but lines cannot always be chopped to the exact length and continue to make sense, so the line length is approximate only. Specifying zero or `\fBunlimited\fP' will remove all restriction, so that \fBxtruss\fP will display the full contents of every request it understands, no matter how big. Default is 256.
|
|
.IP "\fB-o\fP \fIfilename\fP"
|
|
Send the trace output to the specified file, or to standard output if \fIfilename\fP is just `\fB-\fP'. The default is to log to standard error.
|
|
.IP "\fB-e\fP [\fIclass\fP\fB=\fP][\fB!\fP]\fIitem\fP[\fB,\fP\fIitem\fP...]"
|
|
Specify a subset of X requests or X events to log. \fIclass\fP can be either `\fBrequests\fP' or `\fBevents\fP'; if the class is omitted, `\fBrequests\fP' is assumed. The list of \fIitem\fP gives a list of X request names or X event names (respectively) to be logged; all other requests or events are omitted. If the list of items is prefixed with \fB!\fP, it is instead treated as a list of requests or events \fInot\fP to be logged, and anything not in the list is printed. Reply and error packets are not separately filtered: they are logged if and only if the request they respond to was logged.
|
|
.RS
|
|
.PP
|
|
For example, to log only \fBImageText8\fP and \fBImageText16\fP requests, you might say `\fBxtruss -e requests=ImageText8,ImageText16\fP \fIcommand\fP' or just `\fBxtruss -e ImageText8,ImageText16\fP \fIcommand\fP'. To inhibit the display of \fBFocusIn\fP and \fBFocusOut\fP events, you might say `\fBxtruss -e events=!FocusIn,FocusOut\fP \fIcommand\fP'.
|
|
.PP
|
|
(Note that the \fB!\fP character might be treated specially by your shell, so you may need to escape it.)
|
|
.RE
|
|
.IP "\fB-I\fP"
|
|
Log the initialisation message sent by the X server at the start of the connection. This is omitted by default because it's particularly long and ugly.
|
|
.IP "\fB-R\fP"
|
|
As well as translating the X protocol, also give a raw hex dump of all the data transferred over the connection. (Probably most useful to include in a bug report about \fBxtruss\fP itself!)
|
|
.IP "\fB-C\fP"
|
|
Prefix every output line with the X client id (resource base) of the client connection it came from. By default \fBxtruss\fP only starts to do this if it\*(Aqs tracing more than one X client; before then, lines are unprefixed. This option makes prefixing unconditional from the start of the run.
|
|
.SH "BUGS"
|
|
.PP
|
|
Many commonly used X protocol extensions are not currently decoded.
|
|
.PP
|
|
A lot of this program has been only minimally tested.
|
|
.SH "LICENCE"
|
|
.PP
|
|
\fBxtruss\fP is free software, distributed under the MIT/X11 licence. Type \fBxtruss --licence\fP to see the full licence text.
|