aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-02-26 20:10:18 +0000
committerDaniel Jacobowitz <drow@false.org>2007-02-26 20:10:18 +0000
commitc74d0ad8276928d58b080ecd50eb5026aac49c5d (patch)
tree609bae4ed2a63d4b044efa52927634fc265d4904 /gdb/gdbserver
parent2711e4564f4ab411bdf2cedff3fb92abadd630b8 (diff)
downloadgdb-c74d0ad8276928d58b080ecd50eb5026aac49c5d.zip
gdb-c74d0ad8276928d58b080ecd50eb5026aac49c5d.tar.gz
gdb-c74d0ad8276928d58b080ecd50eb5026aac49c5d.tar.bz2
* gdb.texinfo (Monitor commands for gdbserver): New subsection.
* remote-utils.c (monitor_output): New function. * server.c (debug_threads): Define here. (monitor_show_help): New function. (handle_query): Handle qRcmd. (main): Do not handle 'd' packet. * server.h (debug_threads, remote_debug, monitor_output): Declare. * linux-low.c, spu-low.c, win32-i386-low.c: Remove definitions of debug_threads. * gdb.server/server-mon.exp: New test.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog11
-rw-r--r--gdb/gdbserver/linux-low.c2
-rw-r--r--gdb/gdbserver/remote-utils.c12
-rw-r--r--gdb/gdbserver/server.c66
-rw-r--r--gdb/gdbserver/server.h4
-rw-r--r--gdb/gdbserver/spu-low.c1
-rw-r--r--gdb/gdbserver/win32-i386-low.c1
7 files changed, 90 insertions, 7 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 95070cc..b2dd45c 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,14 @@
+2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * remote-utils.c (monitor_output): New function.
+ * server.c (debug_threads): Define here.
+ (monitor_show_help): New function.
+ (handle_query): Handle qRcmd.
+ (main): Do not handle 'd' packet.
+ * server.h (debug_threads, remote_debug, monitor_output): Declare.
+ * linux-low.c, spu-low.c, win32-i386-low.c: Remove definitions
+ of debug_threads.
+
2007-02-25 Pedro Alves <pedro_alves@portugalmail.pt>
* Makefile.in (EXEEXT): New.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 55beebc..790749b 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -77,8 +77,6 @@ struct pending_signals
static int use_regsets_p = 1;
#endif
-int debug_threads = 0;
-
#define pid_of(proc) ((proc)->head.id)
/* FIXME: Delete eventually. */
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index ffacb6e..6a9a176 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1074,3 +1074,15 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp)
return 1;
}
+
+void
+monitor_output (char *msg)
+{
+ char *buf = malloc (strlen (msg) * 2 + 2);
+
+ buf[0] = 'O';
+ hexify (buf + 1, msg, 0);
+
+ putpkt (buf);
+ free (buf);
+}
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index b0a957f..70ecd53 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -35,6 +35,10 @@ unsigned long old_thread_from_wait;
int extended_protocol;
int server_waiting;
+/* Enable miscellaneous debugging output. The name is historical - it
+ was originally used to debug LinuxThreads support. */
+int debug_threads;
+
int pass_signals[TARGET_SIGNAL_LAST];
jmp_buf toplevel;
@@ -235,6 +239,16 @@ get_features_xml (const char *annex)
return document;
}
+void
+monitor_show_help (void)
+{
+ monitor_output ("The following monitor commands are supported:\n");
+ monitor_output (" set debug <0|1>\n");
+ monitor_output (" Enable general debugging messages\n");
+ monitor_output (" set remote-debug <0|1>\n");
+ monitor_output (" Enable remote protocol debugging messages\n");
+}
+
/* Handle all of the extended 'q' packets. */
void
handle_query (char *own_buf, int *new_packet_len_p)
@@ -442,6 +456,55 @@ handle_query (char *own_buf, int *new_packet_len_p)
/* Otherwise, pretend we do not understand this packet. */
}
+ /* Handle "monitor" commands. */
+ if (strncmp ("qRcmd,", own_buf, 6) == 0)
+ {
+ char *mon = malloc (PBUFSIZ);
+ int len = strlen (own_buf + 6);
+
+ if ((len % 1) != 0 || unhexify (mon, own_buf + 6, len / 2) != len / 2)
+ {
+ write_enn (own_buf);
+ free (mon);
+ return;
+ }
+ mon[len / 2] = '\0';
+
+ write_ok (own_buf);
+
+ if (strcmp (mon, "set debug 1") == 0)
+ {
+ debug_threads = 1;
+ monitor_output ("Debug output enabled.\n");
+ }
+ else if (strcmp (mon, "set debug 0") == 0)
+ {
+ debug_threads = 0;
+ monitor_output ("Debug output disabled.\n");
+ }
+ else if (strcmp (mon, "set remote-debug 1") == 0)
+ {
+ remote_debug = 1;
+ monitor_output ("Protocol debug output enabled.\n");
+ }
+ else if (strcmp (mon, "set remote-debug 0") == 0)
+ {
+ remote_debug = 0;
+ monitor_output ("Protocol debug output disabled.\n");
+ }
+ else if (strcmp (mon, "help") == 0)
+ monitor_show_help ();
+ else
+ {
+ monitor_output ("Unknown monitor command.\n\n");
+ monitor_show_help ();
+ write_enn (own_buf);
+ }
+
+ free (mon);
+ return;
+ }
+
/* Otherwise we didn't know what packet it was. Say we didn't
understand it. */
own_buf[0] = 0;
@@ -738,9 +801,6 @@ main (int argc, char *argv[])
case 'Q':
handle_general_set (own_buf);
break;
- case 'd':
- remote_debug = !remote_debug;
- break;
#ifndef USE_WIN32API
/* Skip "detach" support on mingw32, since we don't have
waitpid. */
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index ff5ef3f..462bd68 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -128,12 +128,14 @@ extern unsigned long step_thread;
extern unsigned long thread_from_wait;
extern unsigned long old_thread_from_wait;
extern int server_waiting;
+extern int debug_threads;
extern int pass_signals[];
extern jmp_buf toplevel;
/* From remote-utils.c */
+extern int remote_debug;
extern int all_symbols_looked_up;
int putpkt (char *buf);
@@ -170,6 +172,8 @@ int remote_escape_output (const gdb_byte *buffer, int len,
int look_up_one_symbol (const char *name, CORE_ADDR *addrp);
+void monitor_output (char *msg);
+
/* Functions from ``signals.c''. */
enum target_signal target_signal_from_host (int hostsig);
int target_signal_to_host_p (enum target_signal oursig);
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index b5b5f48..0d1c81a 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -58,7 +58,6 @@
/* These are used in remote-utils.c. */
int using_threads = 0;
-int debug_threads = 0;
/* Fetch PPU register REGNO. */
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c
index 6823b54..b06a31c 100644
--- a/gdb/gdbserver/win32-i386-low.c
+++ b/gdb/gdbserver/win32-i386-low.c
@@ -44,7 +44,6 @@
#define OUTMSG2(X)
#endif
-int debug_threads;
int using_threads = 1;
/* Globals. */