XuNeo commented on code in PR #15623: URL: https://github.com/apache/nuttx/pull/15623#discussion_r1923182694
########## libs/libc/gdbstub/lib_gdbstub.c: ########## @@ -283,9 +287,43 @@ static int gdb_putchar(FAR struct gdb_state_s *state, int ch) return ret; } + if (csum) + { + *csum += tmp; + } + return tmp; } +/**************************************************************************** + * Name: gdb_escapechar + * + * Description: + * Send out a char, do escaping if necessary. + * Do note that for RLE encoded data, the length byte should NOT escape. + * See gdb src of remote.c remote_target::read_frame + * + * Input Parameters: + * state - The pointer to the GDB state structure. + * ch - The character to be sent. + * csum - The checksum. + * + ****************************************************************************/ + +static void gdb_escapechar(FAR struct gdb_state_s *state, char c, + FAR char *csum) +{ + if (c == '#' || c == '$' || c == '}' || c == '*') + { + gdb_putchar(state, '}', csum); + gdb_putchar(state, c ^ 0x20, csum); /* See https://sourceware.org/gdb/current/onlinedocs/gdb.html/Overview.html#Binary-Data */ Review Comment: > End-of-line comments don't seem to be nuttx's habit Yes, but it seems there's no other way to avoid the code style check warning. I have saw the same trick has been used multiple places. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org