From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH] Constify gdbserver "monitor" commands
Date: Wed, 21 Jan 2026 20:17:22 -0700 [thread overview]
Message-ID: <20260122031722.3089932-1-tom@tromey.com> (raw)
I noticed that the gdbserver "monitor" commands should take a const
parameter.
---
gdbserver/linux-low.cc | 2 +-
gdbserver/linux-low.h | 4 ++--
gdbserver/server.cc | 2 +-
gdbserver/target.cc | 2 +-
gdbserver/target.h | 2 +-
gdbserver/thread-db.cc | 2 +-
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index b12f7c08b31..ca20a5bca16 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -6003,7 +6003,7 @@ linux_process_target::handle_new_gdb_connection ()
}
int
-linux_process_target::handle_monitor_command (char *mon)
+linux_process_target::handle_monitor_command (const char *mon)
{
#ifdef USE_THREAD_DB
return thread_db_handle_monitor_command (mon);
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index ae196f5767a..03e11202955 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -245,7 +245,7 @@ class linux_process_target : public process_stratum_target
void handle_new_gdb_connection () override;
- int handle_monitor_command (char *mon) override;
+ int handle_monitor_command (const char *mon) override;
int core_of_thread (ptid_t ptid) override;
@@ -947,7 +947,7 @@ CORE_ADDR linux_get_pc_64bit (struct regcache *regcache);
int thread_db_init (void);
void thread_db_detach (struct process_info *);
void thread_db_mourn (struct process_info *);
-int thread_db_handle_monitor_command (char *);
+int thread_db_handle_monitor_command (const char *);
int thread_db_get_tls_address (thread_info *thread, CORE_ADDR offset,
CORE_ADDR load_module, CORE_ADDR *address);
int thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp);
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index fcad2b973d5..674300f8ce0 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -1714,7 +1714,7 @@ handle_general_monitor_debug (const char *mon)
/* Handle monitor commands not handled by target-specific handlers. */
static void
-handle_monitor_command (char *mon, char *own_buf)
+handle_monitor_command (const char *mon, char *own_buf)
{
if (startswith (mon, "set debug "))
{
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index 5a2e96811b3..43ef421df74 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -550,7 +550,7 @@ process_stratum_target::handle_new_gdb_connection ()
}
int
-process_stratum_target::handle_monitor_command (char *mon)
+process_stratum_target::handle_monitor_command (const char *mon)
{
return 0;
}
diff --git a/gdbserver/target.h b/gdbserver/target.h
index d6ab83768d3..82eab9d1243 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -288,7 +288,7 @@ class process_stratum_target
/* The target-specific routine to process monitor command.
Returns 1 if handled, or 0 to perform default processing. */
- virtual int handle_monitor_command (char *mon);
+ virtual int handle_monitor_command (const char *mon);
/* Returns the core given a thread, or -1 if not known. */
virtual int core_of_thread (ptid_t ptid);
diff --git a/gdbserver/thread-db.cc b/gdbserver/thread-db.cc
index 2370c139afa..7f29788d7d7 100644
--- a/gdbserver/thread-db.cc
+++ b/gdbserver/thread-db.cc
@@ -833,7 +833,7 @@ thread_db_mourn (struct process_info *proc)
For any other command, return 0. */
int
-thread_db_handle_monitor_command (char *mon)
+thread_db_handle_monitor_command (const char *mon)
{
const char *cmd = "set libthread-db-search-path";
size_t cmd_len = strlen (cmd);
--
2.49.0
next reply other threads:[~2026-01-22 3:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 3:17 Tom Tromey [this message]
2026-01-22 3:33 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122031722.3089932-1-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox