[PATCH 3/5] winedbg: Support QStartNoAckMode to reduce verbosity.

Rémi Bernon rbernon at codeweavers.com
Mon Mar 30 10:05:44 CDT 2020


We don't have to validate and acknowledge the packets as long as this
mode is enabled, this will reduce verbosity especially when tracing.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 programs/winedbg/gdbproxy.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 66b1ed626030..5c089a508040 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -94,6 +94,7 @@ struct gdb_context
     struct dbg_process*         process;
     /* Unix environment */
     unsigned long               wine_segs[3];   /* load addresses of the ELF wine exec segments (text, bss and data) */
+    BOOL                        no_ack_mode;
 };
 
 static BOOL tgt_process_gdbproxy_read(HANDLE hProcess, const void* addr,
@@ -1629,15 +1630,11 @@ static enum packet_return packet_query(struct gdb_context* gdbctx)
             return packet_ok;
         if (strncmp(gdbctx->in_packet, "Supported", 9) == 0)
         {
-            if (*target_xml)
-                return packet_reply(gdbctx, "PacketSize=400;qXfer:features:read+");
-            else
-            {
-                /* no features supported */
-                packet_reply_open(gdbctx);
-                packet_reply_close(gdbctx);
-                return packet_done;
-            }
+            packet_reply_open(gdbctx);
+            packet_reply_add(gdbctx, "QStartNoAckMode+;");
+            if (*target_xml) packet_reply_add(gdbctx, "PacketSize=400;qXfer:features:read+");
+            packet_reply_close(gdbctx);
+            return packet_done;
         }
         break;
     case 'T':
@@ -1674,6 +1671,17 @@ static enum packet_return packet_query(struct gdb_context* gdbctx)
     return packet_error;
 }
 
+static enum packet_return packet_set(struct gdb_context* gdbctx)
+{
+    if (strncmp(gdbctx->in_packet, "StartNoAckMode", 14) == 0)
+    {
+        gdbctx->no_ack_mode = TRUE;
+        return packet_ok;
+    }
+
+    return packet_error;
+}
+
 static enum packet_return packet_step(struct gdb_context* gdbctx)
 {
     /* FIXME: add support for address in packet */
@@ -1751,7 +1759,7 @@ static struct packet_entry packet_entries[] =
         {'p', packet_read_register},
         {'P', packet_write_register},
         {'q', packet_query},
-        /* {'Q', packet_set}, */
+        {'Q', packet_set},
         /* {'R', packet,restart}, only in extended mode ! */
         {'s', packet_step},        
         /*{'S', packet_step_signal}, hard(er) to implement */
@@ -1772,7 +1780,8 @@ static BOOL extract_packets(struct gdb_context* gdbctx)
      * end points to the end of the received data buffer
      */
 
-    while ((ptr = memchr(sum, '$', end - sum)) &&
+    while (!gdbctx->no_ack_mode &&
+           (ptr = memchr(sum, '$', end - sum)) &&
            (sum = memchr(ptr, '#', end - ptr)) &&
            _snscanf(sum, end - sum, "#%02x", &cksum) == 1)
     {
@@ -2006,6 +2015,7 @@ static BOOL gdb_init_context(struct gdb_context* gdbctx, unsigned flags, unsigne
     gdbctx->last_sig = 0;
     gdbctx->in_trap = FALSE;
     gdbctx->process = NULL;
+    gdbctx->no_ack_mode = FALSE;
     for (i = 0; i < ARRAY_SIZE(gdbctx->wine_segs); i++)
         gdbctx->wine_segs[i] = 0;
 
-- 
2.26.0.rc2




More information about the wine-devel mailing list