From nobody Sat Apr 11 13:59:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775849240; cv=none; d=zohomail.com; s=zohoarc; b=cDQuEf5ISaJijQJGcyQLU7qVUAQDxTodMIqBXI1eX/ckIZy3IguZUWOuirGJosbAknD5ce7qanlW3qm55gVEquoYKeVWCdyW/tH/ie0/dumu4aaA7Fqb1uMIOiWQkquD7MJx4tfQn6AuKFgO6mV90QmEI37oaanYV0Hq/AcT20w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775849240; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=F3YYGoYh+6KX4BI0Ot/SLLZ0EfYgab3RAz12Uxtp1v8=; b=NdQU8+4VWWahxLa44Wshbk1ECzksaNCJFlMzF/IZReyz2tQld/uaEHRZVc+WIqo4umlmx+2wUYo5AqMUwMrl2CjH003nLrBggubigEmanvgpGrBPWCTOCN1vPd35/McW8XwcQYqM1ItJhUzsJqQvhgVuwREWopaPV6IjGlKzoLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775849240008381.27801733791455; Fri, 10 Apr 2026 12:27:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBHTs-0007gC-Mi; Fri, 10 Apr 2026 15:25:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBHTf-0007TS-Un for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:25:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBHTZ-00030R-KM for qemu-devel@nongnu.org; Fri, 10 Apr 2026 15:25:15 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-mmAlhwesMRWr3VTyoiz81A-1; Fri, 10 Apr 2026 15:25:07 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8D9911956054 for ; Fri, 10 Apr 2026 19:25:06 +0000 (UTC) Received: from localhost (unknown [10.44.22.4]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 17D7419560AB; Fri, 10 Apr 2026 19:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775849108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F3YYGoYh+6KX4BI0Ot/SLLZ0EfYgab3RAz12Uxtp1v8=; b=D76cRPi/l9TkQI+rkDo1fLNGwEiNnp8tkxbqXYZQRg9iEr3FZ5MGtRtvJssyJicfdvTndm bJBTQ0ZXBadsbSKXkNMnt3RmeXaj6AhhLGb6sGETJHXr0dN/6elkkGJU+7HvC2/gQ5mgCM 093zI4Aq7ZTWdejZCP3YCQurLVBpIhU= X-MC-Unique: mmAlhwesMRWr3VTyoiz81A-1 X-Mimecast-MFC-AGG-ID: mmAlhwesMRWr3VTyoiz81A_1775849106 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 10 Apr 2026 23:19:24 +0400 Subject: [PATCH v2 62/67] ui/vnc: replace VNC_DEBUG with trace-events MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260410-qemu-vnc-v2-62-231416f76dc3@redhat.com> References: <20260410-qemu-vnc-v2-0-231416f76dc3@redhat.com> In-Reply-To: <20260410-qemu-vnc-v2-0-231416f76dc3@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=22270; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=1Nsl0avG4c5z+Cz4TpuhxbkjUb+9QEOegkjJXmx4B/k=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBp2U0XCijyepSr+56y9rEhHdbC+FwQ+Wy+pXYF1 c17B9k55vSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCadlNFwAKCRDa6OEJdZac 5YE+D/oDRMuxTRWy2Ma1QiS1WM5vl4S6VuFKuQnHyxWxcvTgTL9RbAXumXxiCoiERRpTzpFG5VO N4vGsCguioJ2CLUqQ4WG67iKPevL7xN7OSnE40Ax//mjN8Otk1PgJgN4xoc839T5GHIcFuZY1zB Du14YWLrTXkJFUXj0xuSPnwgTIMb2Q8ZVpVy6NkRJYscNhRl7XdKLnl+TpHFAZYjg8GLPRe1zcn ei+d+b09kspTsApYVSzCnBM72dTg8zPPLlX9TJGUkcSqfsSnBWL6tD9r2c5ylCexVdbTfuH9w82 Df8k8cvRdGZqc1saM4ZUR22WPoI85DOcpMA04kSr6SFwsmpvzWqDrDaKa/cVQ3qFCdVgUMxQbkv 979W7vBwPY6CzUVCvoubNsDl7yVbtmKZnlJEMldJ9iFi1oET+Y59rV9m/qP0GefQ4jF+t6WVS03 8ceb3V4Be0ALT0svQghmLrYtpbPPP+MdTlaYPMhdUezKRjStV1EYU5ctHT8PgWh+UU/0JqkgaDs l5zlmn6PnY2gNsCEvfCBbMnM2dMyO8rAF1ZeG2+iPNxLYZNNnEw0ycmfNZ15iuO6CqSDhE+Xg8e dMT1IvD4NQboSKxI+CYmZaG3utMUbHjPVvcBr3qSIdzC9IW4pSFssaHKw9R2E2CyyywR1qoBQad fOSUz32qraEdiYw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775849241186158500 Replace #ifdef printf() with run-time trace events. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/vnc.h | 8 ------ ui/vnc-auth-sasl.c | 13 ++++----- ui/vnc-enc-tight.c | 4 +-- ui/vnc-enc-zlib.c | 4 +-- ui/vnc-ws.c | 10 +++---- ui/vnc.c | 83 ++++++++++++++++++++------------------------------= ---- ui/trace-events | 29 ++++++++++++++++++- 7 files changed, 73 insertions(+), 78 deletions(-) diff --git a/ui/vnc.h b/ui/vnc.h index 7341fb0f25c..0324e5a98bc 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -46,14 +46,6 @@ #include "vnc-enc-zrle.h" #include "ui/kbd-state.h" =20 -// #define _VNC_DEBUG 1 - -#ifdef _VNC_DEBUG -#define VNC_DEBUG(fmt, ...) do { fprintf(stderr, fmt, ## __VA_ARGS__); } w= hile (0) -#else -#define VNC_DEBUG(fmt, ...) do { } while (0) -#endif - /*************************************************************************= **** * * Core data structures diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 3f4cfc471d5..9964b969ac2 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -73,10 +73,10 @@ size_t vnc_client_write_sasl(VncState *vs) { size_t ret; =20 - VNC_DEBUG("Write SASL: Pending output %p size %zd offset %zd " - "Encoded: %p size %d offset %d\n", - vs->output.buffer, vs->output.capacity, vs->output.offset, - vs->sasl.encoded, vs->sasl.encodedLength, vs->sasl.encodedOf= fset); + trace_vnc_sasl_write_pending(vs, vs->output.buffer, vs->output.capacit= y, + vs->output.offset, vs->sasl.encoded, + vs->sasl.encodedLength, + vs->sasl.encodedOffset); =20 if (!vs->sasl.encoded) { int err; @@ -157,8 +157,7 @@ size_t vnc_client_read_sasl(VncState *vs) =20 if (err !=3D SASL_OK) return vnc_client_io_error(vs, -1, NULL); - VNC_DEBUG("Read SASL Encoded %p size %ld Decoded %p size %d\n", - encoded, ret, decoded, decodedLen); + trace_vnc_sasl_read_decoded(vs, encoded, ret, decoded, decodedLen); buffer_reserve(&vs->input, decodedLen); buffer_append(&vs->input, decoded, decodedLen); return decodedLen; @@ -717,5 +716,3 @@ void start_auth_sasl(VncState *vs) error_free(local_err); vnc_client_error(vs); } - - diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 9dfe6ae5a24..ca671427018 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -46,6 +46,7 @@ #include "vnc.h" #include "vnc-enc-tight.h" #include "vnc-palette.h" +#include "trace.h" =20 /* Compression level stuff. The following array contains various encoder parameters for each of 10 compression levels (0..9). @@ -795,8 +796,7 @@ static int tight_init_stream(VncState *vs, VncTight *ti= ght, int stream_id, if (zstream->opaque =3D=3D NULL) { int err; =20 - VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", stream_id); - VNC_DEBUG("VNC: TIGHT: opaque =3D %p | vs =3D %p\n", zstream->opaq= ue, vs); + trace_vnc_tight_zlib_init(vs, stream_id, zstream->opaque); zstream->zalloc =3D vnc_zlib_zalloc; zstream->zfree =3D vnc_zlib_zfree; =20 diff --git a/ui/vnc-enc-zlib.c b/ui/vnc-enc-zlib.c index a6d287118aa..657b47ceb2b 100644 --- a/ui/vnc-enc-zlib.c +++ b/ui/vnc-enc-zlib.c @@ -26,6 +26,7 @@ =20 #include "qemu/osdep.h" #include "vnc.h" +#include "trace.h" =20 #define ZALLOC_ALIGNMENT 16 =20 @@ -71,8 +72,7 @@ static int vnc_zlib_stop(VncState *vs, VncWorker *worker) if (zstream->opaque !=3D vs) { int err; =20 - VNC_DEBUG("VNC: initializing zlib stream\n"); - VNC_DEBUG("VNC: opaque =3D %p | vs =3D %p\n", zstream->opaque, vs); + trace_vnc_zlib_init(vs, zstream->opaque); zstream->zalloc =3D vnc_zlib_zalloc; zstream->zfree =3D vnc_zlib_zfree; =20 diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c index 9e3503d93d8..b7d4de41431 100644 --- a/ui/vnc-ws.c +++ b/ui/vnc-ws.c @@ -32,11 +32,11 @@ static void vncws_tls_handshake_done(QIOTask *task, Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { - VNC_DEBUG("Handshake failed %s\n", error_get_pretty(err)); + trace_vnc_ws_tls_handshake_fail(vs, error_get_pretty(err)); vnc_client_error(vs); error_free(err); } else { - VNC_DEBUG("TLS handshake complete, starting websocket handshake\n"= ); + trace_vnc_ws_tls_handshake_complete(vs); if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); } @@ -71,7 +71,7 @@ gboolean vncws_tls_handshake_io(QIOChannel *ioc G_GNUC_UN= USED, vs->vd->tlsauthzid, &err); if (!tls) { - VNC_DEBUG("Failed to setup TLS %s\n", error_get_pretty(err)); + trace_vnc_ws_tls_setup_fail(vs, error_get_pretty(err)); error_free(err); vnc_client_error(vs); return TRUE; @@ -101,11 +101,11 @@ static void vncws_handshake_done(QIOTask *task, Error *err =3D NULL; =20 if (qio_task_propagate_error(task, &err)) { - VNC_DEBUG("Websock handshake failed %s\n", error_get_pretty(err)); + trace_vnc_ws_handshake_fail(vs, error_get_pretty(err)); vnc_client_error(vs); error_free(err); } else { - VNC_DEBUG("Websock handshake complete, starting VNC protocol\n"); + trace_vnc_ws_handshake_complete(vs); vnc_start_protocol(vs); if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); diff --git a/ui/vnc.c b/ui/vnc.c index e1fba53ee57..12a2b10b418 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -75,17 +75,7 @@ static void vnc_disconnect_finish(VncState *vs); =20 static void vnc_set_share_mode(VncState *vs, VncShareMode mode) { -#ifdef _VNC_DEBUG - static const char *mn[] =3D { - [0] =3D "undefined", - [VNC_SHARE_MODE_CONNECTING] =3D "connecting", - [VNC_SHARE_MODE_SHARED] =3D "shared", - [VNC_SHARE_MODE_EXCLUSIVE] =3D "exclusive", - [VNC_SHARE_MODE_DISCONNECTED] =3D "disconnected", - }; - fprintf(stderr, "%s/%p: %s -> %s\n", __func__, - vs->ioc, mn[vs->share_mode], mn[mode]); -#endif + trace_vnc_set_share_mode(vs, vs->ioc, vs->share_mode, mode); =20 switch (vs->share_mode) { case VNC_SHARE_MODE_CONNECTING: @@ -185,8 +175,9 @@ static void vnc_init_basic_info_from_remote_addr(QIOCha= nnelSocket *ioc, qapi_free_SocketAddress(addr); } =20 -static const char *vnc_auth_name(VncDisplay *vd) { - switch (vd->auth) { +static const char *vnc_auth_name(int auth, int subauth) +{ + switch (auth) { case VNC_AUTH_INVALID: return "invalid"; case VNC_AUTH_NONE: @@ -204,7 +195,7 @@ static const char *vnc_auth_name(VncDisplay *vd) { case VNC_AUTH_TLS: return "tls"; case VNC_AUTH_VENCRYPT: - switch (vd->subauth) { + switch (subauth) { case VNC_AUTH_VENCRYPT_PLAIN: return "vencrypt+plain"; case VNC_AUTH_VENCRYPT_TLSNONE: @@ -244,7 +235,7 @@ static VncServerInfo *vnc_server_info_get(VncDisplay *v= d) info =3D g_malloc0(sizeof(*info)); vnc_init_basic_info_from_server_addr(qio_net_listener_sioc(vd->listene= r, 0), qapi_VncServerInfo_base(info), &e= rr); - info->auth =3D g_strdup(vnc_auth_name(vd)); + info->auth =3D g_strdup(vnc_auth_name(vd->auth, vd->subauth)); if (err) { qapi_free_VncServerInfo(info); info =3D NULL; @@ -421,7 +412,7 @@ VncInfo *qmp_query_vnc(Error **errp) =20 info->has_family =3D true; =20 - info->auth =3D g_strdup(vnc_auth_name(vd)); + info->auth =3D g_strdup(vnc_auth_name(vd->auth, vd->subauth)); } =20 qapi_free_SocketAddress(addr); @@ -1382,7 +1373,7 @@ size_t vnc_client_io_error(VncState *vs, ssize_t ret,= Error *err) =20 void vnc_client_error(VncState *vs) { - VNC_DEBUG("Closing down client sock: protocol error\n"); + trace_vnc_client_protocol_error(vs); vnc_disconnect_start(vs); } =20 @@ -1407,7 +1398,7 @@ size_t vnc_client_write_buf(VncState *vs, const uint8= _t *data, size_t datalen) Error *err =3D NULL; ssize_t ret; ret =3D qio_channel_write(vs->ioc, (const char *)data, datalen, &err); - VNC_DEBUG("Wrote wire %p %zd -> %ld\n", data, datalen, ret); + trace_vnc_client_write_wire(vs, data, datalen, ret); return vnc_client_io_error(vs, ret, err); } =20 @@ -1428,9 +1419,9 @@ static size_t vnc_client_write_plain(VncState *vs) size_t ret; =20 #ifdef CONFIG_VNC_SASL - VNC_DEBUG("Write Plain: Pending output %p size %zd offset %zd. Wait SS= F %d\n", - vs->output.buffer, vs->output.capacity, vs->output.offset, - vs->sasl.waitWriteSSF); + trace_vnc_client_write_plain(vs, vs->output.buffer, + vs->output.capacity, vs->output.offset, + vs->sasl.waitWriteSSF); =20 if (vs->sasl.conn && vs->sasl.runSSF && @@ -1531,7 +1522,7 @@ size_t vnc_client_read_buf(VncState *vs, uint8_t *dat= a, size_t datalen) ssize_t ret; Error *err =3D NULL; ret =3D qio_channel_read(vs->ioc, (char *)data, datalen, &err); - VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret); + trace_vnc_client_read_wire(vs, data, datalen, ret); return vnc_client_io_error(vs, ret, err); } =20 @@ -1548,8 +1539,8 @@ size_t vnc_client_read_buf(VncState *vs, uint8_t *dat= a, size_t datalen) static size_t vnc_client_read_plain(VncState *vs) { size_t ret; - VNC_DEBUG("Read plain %p size %zd offset %zd\n", - vs->input.buffer, vs->input.capacity, vs->input.offset); + trace_vnc_client_read_plain(vs, vs->input.buffer, + vs->input.capacity, vs->input.offset); buffer_reserve(&vs->input, 4096); ret =3D vnc_client_read_buf(vs, buffer_end(&vs->input), 4096); if (!ret) @@ -2212,7 +2203,7 @@ static void set_encodings(VncState *vs, int32_t *enco= dings, size_t n_encodings) } break; default: - VNC_DEBUG("Unknown encoding: %d (0x%.8x): %d\n", i, enc, enc); + trace_vnc_client_unknown_encoding(vs, i, enc); break; } } @@ -2580,14 +2571,13 @@ static int protocol_client_msg(VncState *vs, uint8_= t *data, size_t len) case 4: vs->as.fmt =3D AUDIO_FORMAT_U32; break; case 5: vs->as.fmt =3D AUDIO_FORMAT_S32; break; default: - VNC_DEBUG("Invalid audio format %d\n", read_u8(data, 4= )); + trace_vnc_client_invalid_audio_format(vs, read_u8(data= , 4)); vnc_client_error(vs); break; } vs->as.nchannels =3D read_u8(data, 5); if (vs->as.nchannels !=3D 1 && vs->as.nchannels !=3D 2) { - VNC_DEBUG("Invalid audio channel count %d\n", - read_u8(data, 5)); + trace_vnc_client_invalid_audio_channels(vs, read_u8(da= ta, 5)); vnc_client_error(vs); break; } @@ -2597,7 +2587,7 @@ static int protocol_client_msg(VncState *vs, uint8_t = *data, size_t len) * protects calculations involving 'vs->as.freq' later. */ if (freq > 48000) { - VNC_DEBUG("Invalid audio frequency %u > 48000", freq); + trace_vnc_client_invalid_audio_freq(vs, freq); vnc_client_error(vs); break; } @@ -2606,14 +2596,14 @@ static int protocol_client_msg(VncState *vs, uint8_= t *data, size_t len) vs, vs->ioc, vs->as.fmt, vs->as.nchannels, vs->as.freq= ); break; default: - VNC_DEBUG("Invalid audio message %d\n", read_u8(data, 2)); + trace_vnc_client_invalid_audio_msg(vs, read_u8(data, 2)); vnc_client_error(vs); break; } break; =20 default: - VNC_DEBUG("Msg: %d\n", read_u16(data, 0)); + trace_vnc_client_unknown_qemu_msg(vs, read_u16(data, 0)); vnc_client_error(vs); break; } @@ -2648,7 +2638,7 @@ static int protocol_client_msg(VncState *vs, uint8_t = *data, size_t len) break; } default: - VNC_DEBUG("Msg: %d\n", data[0]); + trace_vnc_client_unknown_msg(vs, data[0]); vnc_client_error(vs); break; } @@ -2928,18 +2918,18 @@ static int protocol_version(VncState *vs, uint8_t *= version, size_t len) local[12] =3D 0; =20 if (sscanf(local, "RFB %03d.%03d\n", &vs->major, &vs->minor) !=3D 2) { - VNC_DEBUG("Malformed protocol version %s\n", local); + trace_vnc_client_protocol_version_malformed(vs, local); vnc_client_error(vs); return 0; } - VNC_DEBUG("Client request protocol version %d.%d\n", vs->major, vs->mi= nor); + trace_vnc_client_protocol_version(vs, vs->major, vs->minor); if (vs->major !=3D 3 || (vs->minor !=3D 3 && vs->minor !=3D 4 && vs->minor !=3D 5 && vs->minor !=3D 7 && vs->minor !=3D 8)) { - VNC_DEBUG("Unsupported client version\n"); + trace_vnc_client_protocol_version_unsupported(vs); vnc_write_u32(vs, VNC_AUTH_INVALID); vnc_flush(vs); vnc_client_error(vs); @@ -2959,7 +2949,7 @@ static int protocol_version(VncState *vs, uint8_t *ve= rsion, size_t len) trace_vnc_auth_pass(vs, vs->auth); start_client_init(vs); } else if (vs->auth =3D=3D VNC_AUTH_VNC) { - VNC_DEBUG("Tell client VNC auth\n"); + trace_vnc_client_auth_method(vs, vs->auth); vnc_write_u32(vs, vs->auth); vnc_flush(vs); start_auth_vnc(vs); @@ -3318,10 +3308,7 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSo= cket *sioc, vs->subauth =3D vd->subauth; } } - VNC_DEBUG("Client sioc=3D%p ws=3D%d auth=3D%d subauth=3D%d\n", - sioc, websocket, vs->auth, vs->subauth); - - VNC_DEBUG("New client on socket %p\n", vs->sioc); + trace_vnc_client_setup(vs, sioc, websocket, vs->auth, vs->subauth); qemu_console_listener_set_refresh(&vd->dcl, VNC_REFRESH_INTERVAL_BASE); qio_channel_set_blocking(vs->ioc, false, &error_abort); g_clear_handle_id(&vs->ioc_tag, g_source_remove); @@ -3722,13 +3709,10 @@ vnc_display_setup_auth(int *auth, */ if (websocket || !tlscreds) { if (password) { - VNC_DEBUG("Initializing VNC server with password auth\n"); *auth =3D VNC_AUTH_VNC; } else if (sasl) { - VNC_DEBUG("Initializing VNC server with SASL auth\n"); *auth =3D VNC_AUTH_SASL; } else { - VNC_DEBUG("Initializing VNC server with no auth\n"); *auth =3D VNC_AUTH_NONE; } *subauth =3D VNC_AUTH_INVALID; @@ -3747,27 +3731,20 @@ vnc_display_setup_auth(int *auth, *auth =3D VNC_AUTH_VENCRYPT; if (password) { if (is_x509) { - VNC_DEBUG("Initializing VNC server with x509 password auth= \n"); *subauth =3D VNC_AUTH_VENCRYPT_X509VNC; } else { - VNC_DEBUG("Initializing VNC server with TLS password auth\= n"); *subauth =3D VNC_AUTH_VENCRYPT_TLSVNC; } - } else if (sasl) { if (is_x509) { - VNC_DEBUG("Initializing VNC server with x509 SASL auth\n"); *subauth =3D VNC_AUTH_VENCRYPT_X509SASL; } else { - VNC_DEBUG("Initializing VNC server with TLS SASL auth\n"); *subauth =3D VNC_AUTH_VENCRYPT_TLSSASL; } } else { if (is_x509) { - VNC_DEBUG("Initializing VNC server with x509 no auth\n"); *subauth =3D VNC_AUTH_VENCRYPT_X509NONE; } else { - VNC_DEBUG("Initializing VNC server with TLS no auth\n"); *subauth =3D VNC_AUTH_VENCRYPT_TLSNONE; } } @@ -4216,14 +4193,16 @@ static bool vnc_display_open(VncDisplay *vd, Error = **errp) sasl, false, errp) < 0) { return false; } - trace_vnc_auth_init(vd, 0, vd->auth, vd->subauth); + trace_vnc_auth_init(vd, 0, vd->auth, vd->subauth, + vnc_auth_name(vd->auth, vd->subauth)); =20 if (vnc_display_setup_auth(&vd->ws_auth, &vd->ws_subauth, vd->tlscreds, password, sasl, true, errp) < 0) { return false; } - trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth); + trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth, + vnc_auth_name(vd->ws_auth, vd->ws_subauth)); =20 #ifdef CONFIG_VNC_SASL if (sasl && !vnc_sasl_server_init(errp)) { diff --git a/ui/trace-events b/ui/trace-events index 3eba9ca3a82..c1ea56874ee 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -83,7 +83,7 @@ vnc_job_discard_rect(void *state, void *job, int x, int y= , int w, int h) "VNC jo vnc_job_clamp_rect(void *state, void *job, int x, int y, int w, int h) "VN= C job clamp rect state=3D%p job=3D%p offset=3D%d,%d size=3D%dx%d" vnc_job_clamped_rect(void *state, void *job, int x, int y, int w, int h) "= VNC job clamp rect state=3D%p job=3D%p offset=3D%d,%d size=3D%dx%d" vnc_job_nrects(void *state, void *job, int nrects) "VNC job state=3D%p job= =3D%p nrects=3D%d" -vnc_auth_init(void *display, int websock, int auth, int subauth) "VNC auth= init state=3D%p websock=3D%d auth=3D%d subauth=3D%d" +vnc_auth_init(void *display, int websock, int auth, int subauth, const cha= r *name) "VNC auth init state=3D%p websock=3D%d auth=3D%d subauth=3D%d name= =3D%s" vnc_auth_start(void *state, int method) "VNC client auth start state=3D%p = method=3D%d" vnc_auth_pass(void *state, int method) "VNC client auth passed state=3D%p = method=3D%d" vnc_auth_fail(void *state, int method, const char *message, const char *re= ason) "VNC client auth failed state=3D%p method=3D%d message=3D%s reason=3D= %s" @@ -97,6 +97,33 @@ vnc_auth_sasl_step(void *state, const void *clientdata, = size_t clientlen, const vnc_auth_sasl_ssf(void *state, int ssf) "VNC client auth SASL SSF state=3D= %p size=3D%d" vnc_auth_sasl_username(void *state, const char *name) "VNC client auth SAS= L user state=3D%p name=3D%s" vnc_auth_sasl_acl(void *state, int allow) "VNC client auth SASL ACL state= =3D%p allow=3D%d" +vnc_set_share_mode(void *state, void *ioc, int old_mode, int new_mode) "VN= C set share mode state=3D%p ioc=3D%p old=3D%d new=3D%d" +vnc_client_protocol_error(void *state) "VNC client protocol error state=3D= %p" +vnc_client_write_wire(void *state, const void *data, size_t datalen, ssize= _t ret) "VNC client write wire state=3D%p data=3D%p len=3D%zu ret=3D%zd" +vnc_client_write_plain(void *state, const void *buffer, size_t capacity, s= ize_t offset, int wait_ssf) "VNC client write plain state=3D%p buffer=3D%p = capacity=3D%zu offset=3D%zu wait_ssf=3D%d" +vnc_client_read_wire(void *state, const void *data, size_t datalen, ssize_= t ret) "VNC client read wire state=3D%p data=3D%p len=3D%zu ret=3D%zd" +vnc_client_read_plain(void *state, const void *buffer, size_t capacity, si= ze_t offset) "VNC client read plain state=3D%p buffer=3D%p capacity=3D%zu o= ffset=3D%zu" +vnc_client_unknown_encoding(void *state, int index, int encoding) "VNC cli= ent unknown encoding state=3D%p index=3D%d encoding=3D0x%x" +vnc_client_invalid_audio_format(void *state, int fmt) "VNC client invalid = audio format state=3D%p fmt=3D%d" +vnc_client_invalid_audio_channels(void *state, int channels) "VNC client i= nvalid audio channel count state=3D%p channels=3D%d" +vnc_client_invalid_audio_freq(void *state, unsigned int freq) "VNC client = invalid audio frequency state=3D%p freq=3D%u" +vnc_client_invalid_audio_msg(void *state, int msg) "VNC client invalid aud= io message state=3D%p msg=3D%d" +vnc_client_unknown_qemu_msg(void *state, int msg) "VNC client unknown QEMU= msg state=3D%p msg=3D%d" +vnc_client_unknown_msg(void *state, int msg) "VNC client unknown msg state= =3D%p msg=3D%d" +vnc_client_protocol_version(void *state, int major, int minor) "VNC client= protocol version state=3D%p version=3D%d.%d" +vnc_client_protocol_version_malformed(void *state, const char *version) "V= NC client malformed protocol version state=3D%p version=3D%s" +vnc_client_protocol_version_unsupported(void *state) "VNC client unsupport= ed protocol version state=3D%p" +vnc_client_auth_method(void *state, int auth) "VNC client auth method stat= e=3D%p auth=3D%d" +vnc_client_setup(void *state, void *ioc, int websocket, int auth, int suba= uth) "VNC client setup state=3D%p ioc=3D%p websocket=3D%d auth=3D%d subauth= =3D%d" +vnc_ws_tls_handshake_fail(void *state, const char *msg) "VNC WS TLS handsh= ake failed state=3D%p msg=3D%s" +vnc_ws_tls_handshake_complete(void *state) "VNC WS TLS handshake complete = state=3D%p" +vnc_ws_tls_setup_fail(void *state, const char *msg) "VNC WS TLS setup fail= ed state=3D%p msg=3D%s" +vnc_ws_handshake_fail(void *state, const char *msg) "VNC WS handshake fail= ed state=3D%p msg=3D%s" +vnc_ws_handshake_complete(void *state) "VNC WS handshake complete state=3D= %p" +vnc_sasl_write_pending(void *state, const void *buffer, size_t capacity, s= ize_t offset, const void *encoded, int encoded_len, int encoded_offset) "VN= C SASL write pending state=3D%p buffer=3D%p capacity=3D%zu offset=3D%zu enc= oded=3D%p encoded_len=3D%d encoded_offset=3D%d" +vnc_sasl_read_decoded(void *state, const void *encoded, size_t encoded_len= , const void *decoded, unsigned int decoded_len) "VNC SASL read decoded sta= te=3D%p encoded=3D%p encoded_len=3D%zu decoded=3D%p decoded_len=3D%u" +vnc_zlib_init(void *state, const void *opaque) "VNC zlib init state=3D%p o= paque=3D%p" +vnc_tight_zlib_init(void *state, int stream_id, const void *opaque) "VNC t= ight zlib init state=3D%p stream=3D%d opaque=3D%p" =20 =20 # input.c --=20 2.53.0