simon-git: xtruss (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Sep 12 08:11:31 BST 2020
TL;DR:
0f0234e Tighten up parsing of -p operand.
63116a8 -p mode: make the exit(0) on client disconnect optional. (NFC)
9ce3652 -p mode: tolerate 'client has connected' record type.
701c0c0 -p mode: prepare to trace multiple client ids.
b347399 Add '-p all' and a couple of its friends.
Repository: https://git.tartarus.org/simon/xtruss.git
On the web: https://git.tartarus.org/?p=simon/xtruss.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2020-09-12 08:11:31
commit 0f0234e6f71fd190b4dade21ed562ca2d8055c4c
web diff https://git.tartarus.org/?p=simon/xtruss.git;a=commitdiff;h=0f0234e6f71fd190b4dade21ed562ca2d8055c4c;hp=82973f516019218fdf8c7858a9ce0d55cdf27b16
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Sep 12 07:32:33 2020 +0100
Tighten up parsing of -p operand.
Parsing a string into a number with sscanf will succeed if the string
has a _prefix_ that can be interpreted in the specified way, but it
will say nothing about whether that prefix was followed by anything
else.
I was trying to introduce a mode called '-p all' to trace all X
clients at once via X RECORD, and found that '-p all' is already
parsed without error as 0xA, with the 'll' on the end quietly ignored.
Now I use a %n format to check we ended up scanning the whole string,
so that only valid hex numbers will be interpreted as hex.
uxxtruss.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
commit 63116a85af6599934a6383e934414a1d63744105
web diff https://git.tartarus.org/?p=simon/xtruss.git;a=commitdiff;h=63116a85af6599934a6383e934414a1d63744105;hp=0f0234e6f71fd190b4dade21ed562ca2d8055c4c
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Sep 12 07:48:16 2020 +0100
-p mode: make the exit(0) on client disconnect optional. (NFC)
Currently the flag that enables that behaviour is always set to true.
But I'm shortly going to introduce a mode which changes it.
uxxtruss.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
commit 9ce36527dcf52d653297ec0ac03a2b5f8021619d
web diff https://git.tartarus.org/?p=simon/xtruss.git;a=commitdiff;h=9ce36527dcf52d653297ec0ac03a2b5f8021619d;hp=63116a85af6599934a6383e934414a1d63744105
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Sep 12 07:51:49 2020 +0100
-p mode: tolerate 'client has connected' record type.
Once we start recording multiple X clients at once, the server will
send us records that indicate a new client connecting as well as an
existing one going away. We don't need to _do_ anything with them, but
we do need not to interpret them as protocol confusion and die.
uxxtruss.c | 5 +++++
1 file changed, 5 insertions(+)
commit 701c0c0d360f4c9ea906a10e6f73b4167ce28b92
web diff https://git.tartarus.org/?p=simon/xtruss.git;a=commitdiff;h=701c0c0d360f4c9ea906a10e6f73b4167ce28b92;hp=9ce36527dcf52d653297ec0ac03a2b5f8021619d
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Sep 12 08:04:52 2020 +0100
-p mode: prepare to trace multiple client ids.
I'm gearing up to trace multiple clients at once using X RECORD. So
each client will need a separate 'struct xlog' tracking its state, and
we have to hold those in a tree234 sorted by their client id. Hence,
when we receive a data record from the server, we need to look at the
client id in that record and use it to look up the right xlog in our
tree.
uxxtruss.c | 82 +++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 49 insertions(+), 33 deletions(-)
commit b347399154ecb80862beb5b954191cd68bb9a38e
web diff https://git.tartarus.org/?p=simon/xtruss.git;a=commitdiff;h=b347399154ecb80862beb5b954191cd68bb9a38e;hp=701c0c0d360f4c9ea906a10e6f73b4167ce28b92
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Sep 12 07:35:25 2020 +0100
Add '-p all' and a couple of its friends.
The X RECORD extension has three special modes in addition to
recording a specific X client's traffic. One means 'record all X
clients'; one means 'record all clients connected at the time of
starting to record, but not any that connect after that'; and one is
the opposite of that, meaning 'record all X clients that connect after
this point, but ignore the ones already connected at the time of
starting to record'.
Those all seem like useful modes in xtruss too, so I've implemented
them as '-p all', '-p current' and '-p future' respectively.
The way you signal these special modes in the RECORD protocol is by
passing the special values 3, 1 and 2 (respectively) in the slot for
the client id to watch. So you could already have got xtruss to
implement the basic functionality of these new options via '-p 3', '-p
1' and '-p 2' respectively, by knowing what the protocol-specified
special values are. But the special names also trigger other behaviour
changes, like not exiting as soon as a 'client disconnect' signal is
seen (we want to keep recording all the _other_ clients!), and
printing the client id on every trace line right from the start.
(Not to mention, of course, that '-p all' is easier to remember!)
uxxtruss.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
More information about the tartarus-commits
mailing list