Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 1/3] Constify target_pass_signals and target_program_signals
Date: Sun, 06 Jan 2019 22:46:00 -0000	[thread overview]
Message-ID: <20190106224636.5271-2-tom@tromey.com> (raw)
In-Reply-To: <20190106224636.5271-1-tom@tromey.com>

This constifies the final parameter to target_pass_signals and
target_program_signals and updates the rest of gdb.

Note that I have no way to test the nto-procfs.c change.

gdb/ChangeLog
2019-01-06  Tom Tromey  <tom@tromey.com>

	* target-debug.h (target_debug_print_signals): Constify.
	* nto-procfs.c (nto_procfs_target::pass_signals): Update.
	* procfs.c (procfs_target::pass_signals): Update.
	* linux-nat.c (linux_nat_target::pass_signals): Update.
	* linux-nat.h (class linux_nat_target) <pass_signals>: Update.
	* target-delegates.c: Rebuild.
	* remote.c (remote_target::program_signals): Update.
	(remote_target::pass_signals): Update.
	* target.c (target_pass_signals): Constify argument.
	(target_program_signals): Likewise.
	* target.h (struct target_ops) <pass_signals, program_signals>:
	Constify argument.
	(target_pass_signals, target_program_signals): Constify argument.
---
 gdb/ChangeLog          | 16 ++++++++++++++++
 gdb/linux-nat.c        |  2 +-
 gdb/linux-nat.h        |  2 +-
 gdb/nto-procfs.c       |  5 +++--
 gdb/procfs.c           |  4 ++--
 gdb/remote.c           |  8 ++++----
 gdb/target-debug.h     |  2 +-
 gdb/target-delegates.c | 20 ++++++++++----------
 gdb/target.c           |  4 ++--
 gdb/target.h           |  9 +++++----
 10 files changed, 45 insertions(+), 27 deletions(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 73d4fd193a..c0d5f8dc66 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -788,7 +788,7 @@ static sigset_t pass_mask;
 
 /* Update signals to pass to the inferior.  */
 void
-linux_nat_target::pass_signals (int numsigs, unsigned char *pass_signals)
+linux_nat_target::pass_signals (int numsigs, const unsigned char *pass_signals)
 {
   int signo;
 
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 14995266f9..c56a245c8b 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -45,7 +45,7 @@ public:
 
   ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
 
-  void pass_signals (int, unsigned char *) override;
+  void pass_signals (int, const unsigned char *) override;
 
   enum target_xfer_status xfer_partial (enum target_object object,
 					const char *annex,
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 1a12f54d8a..9ee42e6428 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -109,7 +109,7 @@ struct nto_procfs_target : public inf_child_target
 
   void mourn_inferior () override;
 
-  void pass_signals (int, unsigned char *) override;
+  void pass_signals (int, const unsigned char *) override;
 
   bool thread_alive (ptid_t ptid) override;
 
@@ -1442,7 +1442,8 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
 /* Set list of signals to be handled in the target.  */
 
 void
-nto_procfs_target::pass_signals (int numsigs, unsigned char *pass_signals)
+nto_procfs_target::pass_signals (int numsigs,
+				 const unsigned char *pass_signals)
 {
   int signo;
 
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 9e3d037b69..dd7534aa57 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -119,7 +119,7 @@ public:
 					ULONGEST offset, ULONGEST len,
 					ULONGEST *xfered_len) override;
 
-  void pass_signals (int, unsigned char *) override;
+  void pass_signals (int, const unsigned char *) override;
 
   void files_info () override;
 
@@ -2772,7 +2772,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
 /* Set up to trace signals in the child process.  */
 
 void
-procfs_target::pass_signals (int numsigs, unsigned char *pass_signals)
+procfs_target::pass_signals (int numsigs, const unsigned char *pass_signals)
 {
   sigset_t signals;
   procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
diff --git a/gdb/remote.c b/gdb/remote.c
index 324ed46809..c40f926376 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -474,12 +474,12 @@ public:
 
   void mourn_inferior () override;
 
-  void pass_signals (int, unsigned char *) override;
+  void pass_signals (int, const unsigned char *) override;
 
   int set_syscall_catchpoint (int, bool, int,
 			      gdb::array_view<const int>) override;
 
-  void program_signals (int, unsigned char *) override;
+  void program_signals (int, const unsigned char *) override;
 
   bool thread_alive (ptid_t ptid) override;
 
@@ -2555,7 +2555,7 @@ record_currthread (struct remote_state *rs, ptid_t currthread)
    it can simply pass through to the inferior without reporting.  */
 
 void
-remote_target::pass_signals (int numsigs, unsigned char *pass_signals)
+remote_target::pass_signals (int numsigs, const unsigned char *pass_signals)
 {
   if (packet_support (PACKET_QPassSignals) != PACKET_DISABLE)
     {
@@ -2681,7 +2681,7 @@ remote_target::set_syscall_catchpoint (int pid, bool needed, int any_count,
    signals it should pass through to the inferior when detaching.  */
 
 void
-remote_target::program_signals (int numsigs, unsigned char *signals)
+remote_target::program_signals (int numsigs, const unsigned char *signals)
 {
   if (packet_support (PACKET_QProgramSignals) != PACKET_DISABLE)
     {
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index 67d400a58c..d51754af59 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -209,7 +209,7 @@ target_debug_print_options (int options)
 }
 
 static void
-target_debug_print_signals (unsigned char *sigs)
+target_debug_print_signals (const unsigned char *sigs)
 {
   fputs_unfiltered ("{", gdb_stdlog);
   if (sigs != NULL)
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 2ff800cca3..43c979087f 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -62,8 +62,8 @@ struct dummy_target : public target_ops
   void follow_exec (struct inferior *arg0, char *arg1) override;
   int set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3) override;
   void mourn_inferior () override;
-  void pass_signals (int arg0, unsigned char * arg1) override;
-  void program_signals (int arg0, unsigned char * arg1) override;
+  void pass_signals (int arg0, const unsigned char * arg1) override;
+  void program_signals (int arg0, const unsigned char * arg1) override;
   bool thread_alive (ptid_t arg0) override;
   void update_thread_list () override;
   const char *pid_to_str (ptid_t arg0) override;
@@ -229,8 +229,8 @@ struct debug_target : public target_ops
   void follow_exec (struct inferior *arg0, char *arg1) override;
   int set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3) override;
   void mourn_inferior () override;
-  void pass_signals (int arg0, unsigned char * arg1) override;
-  void program_signals (int arg0, unsigned char * arg1) override;
+  void pass_signals (int arg0, const unsigned char * arg1) override;
+  void program_signals (int arg0, const unsigned char * arg1) override;
   bool thread_alive (ptid_t arg0) override;
   void update_thread_list () override;
   const char *pid_to_str (ptid_t arg0) override;
@@ -1659,18 +1659,18 @@ debug_target::mourn_inferior ()
 }
 
 void
-target_ops::pass_signals (int arg0, unsigned char * arg1)
+target_ops::pass_signals (int arg0, const unsigned char * arg1)
 {
   this->beneath ()->pass_signals (arg0, arg1);
 }
 
 void
-dummy_target::pass_signals (int arg0, unsigned char * arg1)
+dummy_target::pass_signals (int arg0, const unsigned char * arg1)
 {
 }
 
 void
-debug_target::pass_signals (int arg0, unsigned char * arg1)
+debug_target::pass_signals (int arg0, const unsigned char * arg1)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->pass_signals (...)\n", this->beneath ()->shortname ());
   this->beneath ()->pass_signals (arg0, arg1);
@@ -1682,18 +1682,18 @@ debug_target::pass_signals (int arg0, unsigned char * arg1)
 }
 
 void
-target_ops::program_signals (int arg0, unsigned char * arg1)
+target_ops::program_signals (int arg0, const unsigned char * arg1)
 {
   this->beneath ()->program_signals (arg0, arg1);
 }
 
 void
-dummy_target::program_signals (int arg0, unsigned char * arg1)
+dummy_target::program_signals (int arg0, const unsigned char * arg1)
 {
 }
 
 void
-debug_target::program_signals (int arg0, unsigned char * arg1)
+debug_target::program_signals (int arg0, const unsigned char * arg1)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->program_signals (...)\n", this->beneath ()->shortname ());
   this->beneath ()->program_signals (arg0, arg1);
diff --git a/gdb/target.c b/gdb/target.c
index f8e92f5696..e66584f147 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2112,13 +2112,13 @@ make_scoped_defer_target_commit_resume ()
 }
 
 void
-target_pass_signals (int numsigs, unsigned char *pass_signals)
+target_pass_signals (int numsigs, const unsigned char *pass_signals)
 {
   current_top_target ()->pass_signals (numsigs, pass_signals);
 }
 
 void
-target_program_signals (int numsigs, unsigned char *program_signals)
+target_program_signals (int numsigs, const unsigned char *program_signals)
 {
   current_top_target ()->program_signals (numsigs, program_signals);
 }
diff --git a/gdb/target.h b/gdb/target.h
index 36f8942679..14ec07fc0e 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -638,13 +638,13 @@ struct target_ops
     /* Documentation of this routine is provided with the corresponding
        target_* macro.  */
     virtual void pass_signals (int,
-			       unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
+			       const unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
       TARGET_DEFAULT_IGNORE ();
 
     /* Documentation of this routine is provided with the
        corresponding target_* function.  */
     virtual void program_signals (int,
-				  unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
+				  const unsigned char * TARGET_DEBUG_PRINTER (target_debug_print_signals))
       TARGET_DEFAULT_IGNORE ();
 
     virtual bool thread_alive (ptid_t ptid)
@@ -1692,7 +1692,7 @@ extern int target_can_run ();
    about to receive a signal, it needs to be reported in any case, even
    if mentioned in a previous target_pass_signals call.   */
 
-extern void target_pass_signals (int nsig, unsigned char *pass_signals);
+extern void target_pass_signals (int nsig, const unsigned char *pass_signals);
 
 /* Set list of signals the target may pass to the inferior.  This
    directly maps to the "handle SIGNAL pass/nopass" setting.
@@ -1708,7 +1708,8 @@ extern void target_pass_signals (int nsig, unsigned char *pass_signals);
    example, when detaching (as threads may have been suspended with
    pending signals not reported to GDB).  */
 
-extern void target_program_signals (int nsig, unsigned char *program_signals);
+extern void target_program_signals (int nsig,
+				    const unsigned char *program_signals);
 
 /* Check to see if a thread is still alive.  */
 
-- 
2.17.2


  parent reply	other threads:[~2019-01-06 22:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-06 22:46 [PATCH 0/3] Some remote-related constification Tom Tromey
2019-01-06 22:46 ` [PATCH 3/3] Constify some remote-notif functions Tom Tromey
2019-01-06 22:46 ` Tom Tromey [this message]
2019-01-14 22:03   ` [PATCH 1/3] Constify target_pass_signals and target_program_signals Simon Marchi
2019-01-15  0:31     ` Tom Tromey
2019-01-23 18:46   ` [PATCH] target_pass_signals/target_program_signals: Use gdb::array_view (Re: [PATCH 1/3] Constify target_pass_signals and target_program_signals) Pedro Alves
2019-01-23 22:02     ` Tom Tromey
2019-01-06 22:46 ` [PATCH 2/3] Constify remote_console_output Tom Tromey

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=20190106224636.5271-2-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