Skip to contentSkip to conversation

Fix for RSP vCont packet

PATCH In review Lucien Anti-Spam 2 participants 3 messages Jan 31, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 Fix for RSP vCont packet

This fixes a regression in rsp packet vCont due to recently added multiprocess support. (Short commit hash: e40e520).

The result is that vCont now does not recognise the case where no process/thread is provided after the action.
This may not show up with GDB, but using Lauterbach Trace32, and Hexrays IDA Pro this issue is immediately seen.The response is a "$#00" empty packet, showing it is unsupported packet.
This is defined in the RSP document as "An action with no thread-id matches all threads."(https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#vCont-packet )
Thus the valid vCont packets now are as below, however parsing is still not very strict.  vCont;c/s                 - Step/Continue all threads  vCont;c/s:[pX.]Y          - Step/Continue optional process X, thread Y  vCont;C##/S##:[pX.]Y      - Step/Continue with signal ## on optional process X, thread Y  * If X or Y are -1 then it applies the action to all processes/threads.

gdbstub.cindex bfc7afb509..ce0dde2e24 100644--- a/gdbstub.c+++ b/gdbstub.c@@ -1169,6 +1169,7 @@ static int is_query_packet(const char *p, const char *query, char separator)  */ static int gdb_handle_vcont(GDBState *s, const char *p) {+    GDBThreadIdKind vcontThreadType ;     int res, signal = 0;     char cur_action;     char *newstates;@@ -1218,12 +1219,23 @@ static int gdb_handle_vcont(GDBState *s, const char *p)             goto out;         } -        if (*p++ != ':') {+        /*+         * In the case we have vCont;c or vCont;s - action is on all threads+         * Alternatively vCont;c;s:p1.1 is a possible, but meaningless format,+         * And in the else the "vCont;c:p1.1;... format is supported.+         */+        if (*p == '\0' || *p == ';') {+            vcontThreadType = GDB_ALL_THREADS ;+            pid = 1 ;+            tid = 1 ;+        } else if (*p++ == ':') {+            vcontThreadType = read_thread_id(p, &p, &pid, &tid) ;+        } else {             res = -ENOTSUP;             goto out;         } -        switch (read_thread_id(p, &p, &pid, &tid)) {+        switch (vcontThreadType) {         case GDB_READ_THREAD_ERR:             res = -EINVAL;             goto out;-- 2.17.2 renamed from gdbstub.c +0 -0
#2 lore raw
Quoted 2 lines · Lucien Anti-Spam via Qemu-devel

This fixes a regression in rsp packet vCont due to recently added multiprocess support. (Short commit hash: e40e520).

Your mailer completely botched the message (wrong line endings?) Can you please resend, preferably using git send-email, or at a minimum attaching git format-patch output rather than inline pasting, so that we stand a chance of seeing what you actually intended?

Quoted 7 lines

The result is that vCont now does not recognise the case where no process/thread is provided after the action.
This may not show up with GDB, but using Lauterbach Trace32, and Hexrays IDA Pro this issue is immediately seen.The response is a "$#00" empty packet, showing it is unsupported packet.
This is defined in the RSP document as "An action with no thread-id matches all threads."(https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#vCont-packet )
Thus the valid vCont packets now are as below, however parsing is still not very strict.  vCont;c/s                 - Step/Continue all threads  vCont;c/s:[pX.]Y          - Step/Continue optional process X, thread Y  vCont;C##/S##:[pX.]Y      - Step/Continue with signal ## on optional process X, thread Y  * If X or Y are -1 then it applies the action to all processes/threads.

gdbstub.cindex bfc7afb509..ce0dde2e24 100644--- a/gdbstub.c+++ b/gdbstub.c@@ -1169,6 +1169,7 @@ static int is_query_packet(const char *p, const char *query, char separator)  */ static int gdb_handle_vcont(GDBState *s, const char *p) {+    GDBThreadIdKind vcontThreadType ;     int res, signal = 0;     char cur_action;     char *newstates;@@ -1218,12 +1219,23 @@ static int gdb_handle_vcont(GDBState *s, const char *p)             goto out;         } -        if (*p++ != ':') {+        /*+         * In the case we have vCont;c or vCont;s - action is on all threads+         * Alternatively vCont;c;s:p1.1 is a possible, but meaningless format,+         * And in the else the "vCont;c:p1.1;... format is supported.+         */+        if (*p == '\0' || *p == ';') {+            vcontThreadType = GDB_ALL_THREADS ;+            pid = 1 ;+            tid = 1 ;+        } else if (*p++ == ':') {+            vcontThreadType = read_thread_id(p, &p, &pid, &tid) ;+        } else {             res = -ENOTSUP;             goto out;         } -        switch (read_thread_id(p, &p, &pid, &tid)) {+        switch (vcontThreadType) {         case GDB_READ_THREAD_ERR:             res = -EINVAL;             goto out;-- 2.17.2 renamed from gdbstub.c +0 -0
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
#3 lore raw
 

    On Thursday, January 31, 2019, 12:47:23 PM GMT+9, Eric Blake <[email protected]> wrote:  
Quoted 3 lines · Lucien Anti-Spam via Qemu-devel
Quoted 2 lines

This fixes a regression in rsp packet vCont due to recently added multiprocess support. (Short commit hash: e40e520).

 Your mailer completely botched the message (wrong line endings?)  Can ...

Sorry about that - none of my linux machines have smtp access and my workaround mangled it.I am trying to work out another way around that now.