Skip to content

Commit fb82c0f

Browse files
committed
repair gdbstub to match the gdbserial protocol specification
The gdbserial protocol handler should return an empty packet instead of an error string when ever it responds to a command it does not implement. The problem cases come from a debugger client sending qTBuffer, qTStatus, qSearch, qSupported. The incorrect response from the gdbstub leads the debugger clients to not function correctly. Recent versions of gdb will not detach correctly as a result of this behavior. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
1 parent 1396a21 commit fb82c0f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

kernel/debug/gdbstub.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,8 @@ static void gdb_cmd_query(struct kgdb_state *ks)
621621
switch (remcom_in_buffer[1]) {
622622
case 's':
623623
case 'f':
624-
if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10)) {
625-
error_packet(remcom_out_buffer, -EINVAL);
624+
if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10))
626625
break;
627-
}
628626

629627
i = 0;
630628
remcom_out_buffer[0] = 'm';
@@ -665,10 +663,9 @@ static void gdb_cmd_query(struct kgdb_state *ks)
665663
pack_threadid(remcom_out_buffer + 2, thref);
666664
break;
667665
case 'T':
668-
if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16)) {
669-
error_packet(remcom_out_buffer, -EINVAL);
666+
if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16))
670667
break;
671-
}
668+
672669
ks->threadid = 0;
673670
ptr = remcom_in_buffer + 17;
674671
kgdb_hex2long(&ptr, &ks->threadid);

0 commit comments

Comments
 (0)