gdb_server: Log both incoming and outgoing GDB packets
authorJan Matyas <matyas@codasip.com>
Fri, 21 May 2021 06:02:29 +0000 (08:02 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 4 Jun 2021 16:43:26 +0000 (17:43 +0100)
commit49820b8afd150af8df3c02c717d86b8d2cdf7cad
tree6cfa248fc02c155239b8c04f5a127ee02bd95f4f
parenta8d3f601136ccfe446041631cb46a62922f46bca
gdb_server: Log both incoming and outgoing GDB packets

- Made sure that also outgoing GDB packets are logged,
  not only the incoming ones.

- Improved the treatment of non-printable characters
  in the packets to make it more robust.

Prior to this change:

- Outgoing packets were not printed unless OpenOCD was
  re-compiled with _DEBUG_GDB_IO_.
- Non-prinable characters were only treated in incoming
  'X' packets.

After this change:

- Both incoming and outgoing GDB packets are logged
  on debug_level >= 3, so that both directions of the
  GDB channel are visible.
- Non-printable characters are checked for in every packet
  so that hey do not interfere with the terminal.

Change-Id: I0613e57ae5059b3279b0abcb71276cf5719a8699
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6269
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/helper/log.c
src/helper/log.h
src/server/gdb_server.c