* 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.
This commit is contained in:
parent
2711e4564f
commit
c74d0ad827
11 changed files with 176 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.texinfo (Monitor commands for gdbserver): New subsection.
|
||||||
|
|
||||||
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
|
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* src/gdb/doc/gdb.texinfo (Standard Target Features): Mention
|
* src/gdb/doc/gdb.texinfo (Standard Target Features): Mention
|
||||||
|
|
|
@ -12775,6 +12775,29 @@ already on the target.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@subsection Monitor commands for @code{gdbserver}
|
||||||
|
@cindex monitor commands, for @code{gdbserver}
|
||||||
|
|
||||||
|
During a @value{GDBN} session using @code{gdbserver}, you can use the
|
||||||
|
@code{monitor} command to send special requests to @code{gdbserver}.
|
||||||
|
Here are the available commands; they are only of interest when
|
||||||
|
debugging @value{GDBN} or @code{gdbserver}.
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@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
|
||||||
|
protocol (@pxref{Remote Protocol}).
|
||||||
|
|
||||||
|
@end table
|
||||||
|
|
||||||
@node Remote configuration
|
@node Remote configuration
|
||||||
@section Remote configuration
|
@section Remote configuration
|
||||||
|
|
||||||
|
|
|
@ -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>
|
2007-02-25 Pedro Alves <pedro_alves@portugalmail.pt>
|
||||||
|
|
||||||
* Makefile.in (EXEEXT): New.
|
* Makefile.in (EXEEXT): New.
|
||||||
|
|
|
@ -77,8 +77,6 @@ struct pending_signals
|
||||||
static int use_regsets_p = 1;
|
static int use_regsets_p = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int debug_threads = 0;
|
|
||||||
|
|
||||||
#define pid_of(proc) ((proc)->head.id)
|
#define pid_of(proc) ((proc)->head.id)
|
||||||
|
|
||||||
/* FIXME: Delete eventually. */
|
/* FIXME: Delete eventually. */
|
||||||
|
|
|
@ -1074,3 +1074,15 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp)
|
||||||
|
|
||||||
return 1;
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,10 @@ unsigned long old_thread_from_wait;
|
||||||
int extended_protocol;
|
int extended_protocol;
|
||||||
int server_waiting;
|
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];
|
int pass_signals[TARGET_SIGNAL_LAST];
|
||||||
|
|
||||||
jmp_buf toplevel;
|
jmp_buf toplevel;
|
||||||
|
@ -235,6 +239,16 @@ get_features_xml (const char *annex)
|
||||||
return document;
|
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. */
|
/* Handle all of the extended 'q' packets. */
|
||||||
void
|
void
|
||||||
handle_query (char *own_buf, int *new_packet_len_p)
|
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. */
|
/* 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
|
/* Otherwise we didn't know what packet it was. Say we didn't
|
||||||
understand it. */
|
understand it. */
|
||||||
own_buf[0] = 0;
|
own_buf[0] = 0;
|
||||||
|
@ -738,9 +801,6 @@ main (int argc, char *argv[])
|
||||||
case 'Q':
|
case 'Q':
|
||||||
handle_general_set (own_buf);
|
handle_general_set (own_buf);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
|
||||||
remote_debug = !remote_debug;
|
|
||||||
break;
|
|
||||||
#ifndef USE_WIN32API
|
#ifndef USE_WIN32API
|
||||||
/* Skip "detach" support on mingw32, since we don't have
|
/* Skip "detach" support on mingw32, since we don't have
|
||||||
waitpid. */
|
waitpid. */
|
||||||
|
|
|
@ -128,12 +128,14 @@ extern unsigned long step_thread;
|
||||||
extern unsigned long thread_from_wait;
|
extern unsigned long thread_from_wait;
|
||||||
extern unsigned long old_thread_from_wait;
|
extern unsigned long old_thread_from_wait;
|
||||||
extern int server_waiting;
|
extern int server_waiting;
|
||||||
|
extern int debug_threads;
|
||||||
extern int pass_signals[];
|
extern int pass_signals[];
|
||||||
|
|
||||||
extern jmp_buf toplevel;
|
extern jmp_buf toplevel;
|
||||||
|
|
||||||
/* From remote-utils.c */
|
/* From remote-utils.c */
|
||||||
|
|
||||||
|
extern int remote_debug;
|
||||||
extern int all_symbols_looked_up;
|
extern int all_symbols_looked_up;
|
||||||
|
|
||||||
int putpkt (char *buf);
|
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);
|
int look_up_one_symbol (const char *name, CORE_ADDR *addrp);
|
||||||
|
|
||||||
|
void monitor_output (char *msg);
|
||||||
|
|
||||||
/* Functions from ``signals.c''. */
|
/* Functions from ``signals.c''. */
|
||||||
enum target_signal target_signal_from_host (int hostsig);
|
enum target_signal target_signal_from_host (int hostsig);
|
||||||
int target_signal_to_host_p (enum target_signal oursig);
|
int target_signal_to_host_p (enum target_signal oursig);
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
|
|
||||||
/* These are used in remote-utils.c. */
|
/* These are used in remote-utils.c. */
|
||||||
int using_threads = 0;
|
int using_threads = 0;
|
||||||
int debug_threads = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/* Fetch PPU register REGNO. */
|
/* Fetch PPU register REGNO. */
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
#define OUTMSG2(X)
|
#define OUTMSG2(X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int debug_threads;
|
|
||||||
int using_threads = 1;
|
int using_threads = 1;
|
||||||
|
|
||||||
/* Globals. */
|
/* Globals. */
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.server/server-mon.exp: New test.
|
||||||
|
|
||||||
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
|
2007-02-26 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* gdb.cp/cp-relocate.cc, gdb.cp/cp-relocate.exp: New.
|
* gdb.cp/cp-relocate.cc, gdb.cp/cp-relocate.exp: New.
|
||||||
|
|
55
gdb/testsuite/gdb.server/server-mon.exp
Normal file
55
gdb/testsuite/gdb.server/server-mon.exp
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
# This testcase is part of GDB, the GNU debugger.
|
||||||
|
|
||||||
|
# Copyright 2007 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
# Test gdbserver monitor commands.
|
||||||
|
|
||||||
|
load_lib gdbserver-support.exp
|
||||||
|
|
||||||
|
set testfile "server"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
|
||||||
|
if { [skip_gdbserver_tests] } {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
gdb_start
|
||||||
|
|
||||||
|
gdbserver_load $binfile ""
|
||||||
|
gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
|
||||||
|
gdb_test_multiple "monitor help" "" {
|
||||||
|
-re "Unknown monitor command.*$gdb_prompt $" {
|
||||||
|
fail "monitor help"
|
||||||
|
}
|
||||||
|
-re "The following monitor commands.*$gdb_prompt $" {
|
||||||
|
pass "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\\."
|
Loading…
Add table
Add a link
Reference in a new issue