aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-11-07 16:46:34 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-12-08 17:52:00 +0000
commit8fd5a6058fc14e1d460fa166457f949e23e50b5f (patch)
treef97c040dfebfe77f659a672373c595d5b3bc83fe /gdb
parent3bf9e166ca76e89a7c8ed95bf8340f4d5e80e143 (diff)
downloadgdb-8fd5a6058fc14e1d460fa166457f949e23e50b5f.zip
gdb-8fd5a6058fc14e1d460fa166457f949e23e50b5f.tar.gz
gdb-8fd5a6058fc14e1d460fa166457f949e23e50b5f.tar.bz2
gdbserver: allow for general 'monitor set debug COMPONENT VALUE' use
Building on the last commit, which added a general --debug=COMPONENT option to the gdbserver command line, this commit updates the monitor command to allow for general: (gdb) monitor set debug COMPONENT off|on style commands. Just like with the previous commit, the COMPONENT can be any one of all, threads, remote, event-loop, and correspond to the same set of global debug flags. While on the command line it is possible to do: --debug=remote,event-loop,threads the components have to be entered one at a time with the monitor command. I guess there's no reason why we couldn't allow component grouping within the monitor command, but (to me) what I have here seemed more in the spirit of GDB's existing 'set debug ...' commands. If people want it then we can always add component grouping later. Notice in the above that I use 'off' and 'on' instead of '0' and '1', which is what the 'monitor set debug' command used to use. The 0/1 can still be used, but I now advertise off/on in all the docs and help text, again, this feels more inline with GDB's existing boolean settings. I have removed the two existing monitor commands: monitor set remote-debug 0|1 monitor set event-loop-debug 0|1 These are replaced by: monitor set debug remote off|on monitor set debug event-loop off|on respectively. Approved-By: Tom Tromey <tom@tromey.com> Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/NEWS8
-rw-r--r--gdb/doc/gdb.texinfo30
-rw-r--r--gdb/testsuite/gdb.server/server-mon.exp46
3 files changed, 73 insertions, 11 deletions
diff --git a/gdb/NEWS b/gdb/NEWS
index 94d1fd8..c8166f0 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -48,6 +48,14 @@ show remote thread-options-packet
supported components are: all, threads, event-loop, and remote.
If no components are given then threads is assumed.
+ ** The 'monitor set remote-debug' and 'monitor set event-loop-debug'
+ command have been removed.
+
+ ** The 'monitor set debug 0|1' command has been extended to take a
+ component name, e.g.: 'monitor set debug COMPONENT off|on'.
+ Possible component names are: all, threads, event-loop, and
+ remote.
+
* Python API
** New function gdb.notify_mi(NAME, DATA), that emits custom
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6d20e4c..15c7199 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23805,15 +23805,31 @@ Here are the available commands.
@item monitor help
List the available monitor commands.
-@item monitor set debug 0
-@itemx monitor set debug 1
-Disable or enable general debugging messages.
-
-@item monitor set remote-debug 0
-@itemx monitor set remote-debug 1
-Disable or enable specific debugging messages associated with the remote
+@item monitor set debug off
+Disable all internal logging from gdbserver.
+
+@item monitor set debug on
+Enable some general logging from within gdbserver. Currently this is
+equivalent to @kbd{monitor set debug threads on}, but this might
+change in future releases of gdbserver.
+
+@item monitor set debug threads off
+@itemx monitor set debug threads on
+Disable or enable specific logging messages associated with thread
+handling in gdbserver. Currently this category also includes
+additional output not specifically related to thread handling, this
+could change in future releases of gdbserver.
+
+@item monitor set debug remote off
+@itemx monitor set debug remote on
+Disable or enable specific logging messages associated with the remote
protocol (@pxref{Remote Protocol}).
+@item monitor set debug event-loop off
+@itemx monitor set debug event-loop on
+Disable or enable specific logging messages associated with
+gdbserver's event-loop.
+
@item monitor set debug-file filename
@itemx monitor set debug-file
Send any debug output to the given file, or to stderr.
diff --git a/gdb/testsuite/gdb.server/server-mon.exp b/gdb/testsuite/gdb.server/server-mon.exp
index 728cc84..c9bf2e4 100644
--- a/gdb/testsuite/gdb.server/server-mon.exp
+++ b/gdb/testsuite/gdb.server/server-mon.exp
@@ -44,10 +44,48 @@ gdb_test_multiple "monitor help" "monitor help" {
gdb_test "monitor" "Unknown monitor command.*Protocol error.*"
-gdb_test "monitor set debug 1" "Debug output enabled\\."
-gdb_test "monitor set debug 0" "Debug output disabled\\."
-gdb_test "monitor set remote-debug 1" "Protocol debug output enabled\\."
-gdb_test "monitor set remote-debug 0" "Protocol debug output disabled\\."
+gdb_test "monitor set debug 1" "General debug output enabled\\."
+gdb_test "monitor set debug 0" "All debug output disabled\\."
+gdb_test "monitor set debug yeah" \
+ [multi_line \
+ "Missing value for 'set debug yeah' command\\." \
+ "The following monitor commands are supported:" \
+ ".*"]
+gdb_test "monitor set debug on sometimes" \
+ [multi_line \
+ "Junk 'sometimes' found at end of 'set debug on' command\\." \
+ "The following monitor commands are supported:" \
+ ".*"]
+gdb_test "monitor set debug on" "General debug output enabled\\."
+gdb_test "monitor set debug off" "All debug output disabled\\."
+gdb_test "monitor set debug remote 1" "Debug output for 'remote' enabled\\."
+gdb_test "monitor set debug remote 0" "Debug output for 'remote' disabled\\."
+gdb_test "monitor set debug remote on" "Debug output for 'remote' enabled\\."
+gdb_test "monitor set debug remote off" "Debug output for 'remote' disabled\\."
+gdb_test "monitor set debug event-loop 1" "Debug output for 'event-loop' enabled\\."
+gdb_test "monitor set debug event-loop 0" "Debug output for 'event-loop' disabled\\."
+gdb_test "monitor set debug event-loop on" "Debug output for 'event-loop' enabled\\."
+gdb_test "monitor set debug event-loop off" "Debug output for 'event-loop' disabled\\."
+gdb_test "monitor set debug threads 1" "Debug output for 'threads' enabled\\."
+gdb_test "monitor set debug threads 0" "Debug output for 'threads' disabled\\."
+gdb_test "monitor set debug threads on" "Debug output for 'threads' enabled\\."
+gdb_test "monitor set debug threads off" "Debug output for 'threads' disabled\\."
+gdb_test "monitor set debug all 1" "Debug output for 'all' enabled\\."
+gdb_test "monitor set debug all 0" "Debug output for 'all' disabled\\."
+gdb_test "monitor set debug all on" "Debug output for 'all' enabled\\."
+gdb_test "monitor set debug all off" "Debug output for 'all' disabled\\."
+gdb_test "monitor set debug all yeah" \
+ [multi_line \
+ "Invalid value 'yeah' for 'set debug all'\\." \
+ "The following monitor commands are supported:" \
+ ".*"]
+gdb_test "monitor set debug all on sometimes" \
+ [multi_line \
+ "Junk 'sometimes' found at end of 'set debug all on' command\\." \
+ "The following monitor commands are supported:" \
+ ".*"]
+
+
gdb_test "monitor set debug-format all" \
"All extra debug format options enabled\\."
gdb_test "monitor set debug-format none" \