summaryrefslogtreecommitdiffstats
path: root/src/if_xcmdsrv.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-30 18:12:19 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-30 18:12:19 +0000
commit4c5678ff0c376661d4a8183a5a074a1203413b9d (patch)
tree2ddd73cae34d17f2eb4290fda1131bb63f4a0fab /src/if_xcmdsrv.c
parenta87749e3eae3f918b6678f45cf975f0cf06d3e97 (diff)
patch 9.0.0977: it is not easy to see what client-server commands are doingv9.0.0977
Problem: It is not easy to see what client-server commands are doing. Solution: Add channel log messages if ch_log() is available. Move the channel logging and make it available with the +eval feature.
Diffstat (limited to 'src/if_xcmdsrv.c')
-rw-r--r--src/if_xcmdsrv.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c
index 1f6b8d212f..1aa09fd4a3 100644
--- a/src/if_xcmdsrv.c
+++ b/src/if_xcmdsrv.c
@@ -388,11 +388,12 @@ serverSendToVim(
if (name == NULL || *name == NUL)
name = (char_u *)"GVIM"; // use a default name
- if (commProperty == None && dpy != NULL)
- {
- if (SendInit(dpy) < 0)
- return -1;
- }
+ if (commProperty == None && dpy != NULL && SendInit(dpy) < 0)
+ return -1;
+
+#if defined(FEAT_EVAL)
+ ch_log(NULL, "serverSendToVim(%s, %s)", name, cmd);
+#endif
// Execute locally if no display or target is ourselves
if (dpy == NULL || (serverName != NULL && STRICMP(name, serverName) == 0))
@@ -494,6 +495,11 @@ serverSendToVim(
break;
}
}
+
+#if defined(FEAT_EVAL)
+ ch_log(NULL, "serverSendToVim() result: %s",
+ pending.result == NULL ? "NULL" : (char *)pending.result);
+#endif
if (result != NULL)
*result = pending.result;
else
@@ -1221,6 +1227,10 @@ server_parse_message(
int code;
char_u *tofree;
+#if defined(FEAT_EVAL)
+ ch_log(NULL, "server_parse_message() numItems: %ld", numItems);
+#endif
+
/*
* Several commands and results could arrive in the property at
* one time; each iteration through the outer loop handles a
@@ -1240,7 +1250,7 @@ server_parse_message(
continue;
}
- if ((*p == 'c' || *p == 'k') && (p[1] == 0))
+ if ((*p == 'c' || *p == 'k') && p[1] == 0)
{
Window resWindow;
char_u *name, *script, *serial, *end;
@@ -1261,6 +1271,9 @@ server_parse_message(
enc = NULL;
while ((long_u)(p - propInfo) < numItems && *p == '-')
{
+#if defined(FEAT_EVAL)
+ ch_log(NULL, "server_parse_message() item: %c, %s", p[-2], p);
+#endif
switch (p[1])
{
case 'r':
@@ -1326,7 +1339,8 @@ server_parse_message(
ga_concat(&reply, res);
else
{
- ga_concat(&reply, (char_u *)_(e_invalid_expression_received));
+ ga_concat(&reply,
+ (char_u *)_(e_invalid_expression_received));
ga_append(&reply, 0);
ga_concat(&reply, (char_u *)"-c 1");
}