From ba44f139a4dbff134f49326edcf26a59afc2b40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Mon, 12 Jan 1998 02:57:11 +0100 Subject: [PATCH] * Xlib.pmod: If DEBUG is defined, associate error mappings with the request that failed. Rev: lib/modules/Protocols.pmod/X.pmod/Xlib.pmod:1.17 --- lib/modules/Protocols.pmod/X.pmod/Xlib.pmod | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/modules/Protocols.pmod/X.pmod/Xlib.pmod b/lib/modules/Protocols.pmod/X.pmod/Xlib.pmod index c56b413e08..c9421ec8d9 100644 --- a/lib/modules/Protocols.pmod/X.pmod/Xlib.pmod +++ b/lib/modules/Protocols.pmod/X.pmod/Xlib.pmod @@ -4,6 +4,8 @@ #include "error.h" +#define DEBUG + constant XPORT = 6000; class rec_buffer @@ -171,6 +173,10 @@ class Display mapping pending_requests; /* Pending requests */ object pending_actions; /* Actions awaiting handling */ +#ifdef DEBUG + mapping debug_requests = ([ ]); +#endif + void create() { /* Delay initialization of id_manager */ atom_manager::create(); @@ -407,6 +413,9 @@ class Display errorCode, m->sequenceNumber, m->resourceID, m->minorCode, m->majorCode); m->errorCode = _Xlib.error_codes[errorCode]; +#ifdef DEBUG + m->failed_request = debug_requests[m->sequenceNumber]; +#endif #if 0 if (m->errorCode == "Success") { @@ -794,8 +803,12 @@ class Display int send_request(object req, mixed|void handler) { - send(req->to_string()); - return sequence_number++; + string data = req->to_string(); + send(data); +#ifdef DEBUG + debug_requests[sequence_number & 0x7fff] = data; +#endif DEBUG + return sequence_number++ & 0x7fff; } array blocking_request(object req) -- GitLab