]> git.gag.com Git - fw/openocd/commit
gdb_server: simplify logic to enable/disable gdb_log_callback()
authorAntonio Borneo <borneo.antonio@gmail.com>
Mon, 31 Jan 2022 09:08:29 +0000 (10:08 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 19 Mar 2022 09:10:17 +0000 (09:10 +0000)
commit5c26fd7ab8916d25cb876487d39ec45e3c936d55
treeb773748d7e83aefb9e8fb03aabe7b8726bcfe9d7
parent99c77806fea2625dfa2b5a3234267634d0342388
gdb_server: simplify logic to enable/disable gdb_log_callback()

GDB client cannot always display generic messages from OpenOCD.
The callback gdb_log_callback() is continuously added and removed
to follow the GDB status and thus enabling/disabling sending the
OpenOCD output to GDB.
While this is a nice stress test for log_{add,remove}_callback(),
it is also a waste of computational resources that could impact
the speed of OpenOCD during GDB user interactions.

Add a connection-level flag to enable/disable the log callback and
simply change the flag instead of adding/removing the callback.

Use an enum for the flag instead of a bool. This improves code
readability and allows setting other states, e.g. keep-alive
through asynchronous notification https://review.openocd.org/4828/

Change-Id: I072d3c6928dedfd0cef0abe7acf9bdd4b89dbf5b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6839
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
src/server/gdb_server.c