This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Add a parameter `own_buf' to handle_monitor_command
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 8 Feb 2012 22:45:50 +0800
- Subject: [patch] Add a parameter `own_buf' to handle_monitor_command
Hi,
At the end of gdbserver/server.c:handle_monitor_command, global variable
`own_buf' is used. However, in the caller of handler_monitor_command,
handle_query, `own_buf' is passed as the first parameter. This gives me
a feeling that we should pass `own_buf' to handle_monitor_command as
parameter as well.
This patch is quite trivial, and original code works. I still feel we
should get rid of using global variables as much as we can.
--
Yao (éå)
gdb/gdbserver/
2012-02-08 Yao Qi <yao@codesourcery.com>
* server.c: (handle_monitor_command): Add a new parameter
`own_buf'.
(handle_query): Update caller.
---
gdb/gdbserver/server.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index c1788a9..07d06cd 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -811,7 +812,7 @@ handle_search_memory (char *own_buf, int packet_len)
/* Handle monitor commands not handled by target-specific handlers. */
static void
-handle_monitor_command (char *mon)
+handle_monitor_command (char *mon, char *own_buf)
{
if (strcmp (mon, "set debug 1") == 0)
{
@@ -1737,7 +1738,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
if (the_target->handle_monitor_command == NULL
|| (*the_target->handle_monitor_command) (mon) == 0)
/* Default processing. */
- handle_monitor_command (mon);
+ handle_monitor_command (mon, own_buf);
free (mon);
return;
--
1.7.0.4