public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdbserver: Remove unused argument in register_data()
@ 2020-10-06 11:20 Shahab Vahedi
  2020-10-06 12:16 ` [PATCH v2] " Shahab Vahedi
  2020-10-06 15:25 ` [PUSHED] " Shahab Vahedi
  0 siblings, 2 replies; 4+ messages in thread
From: Shahab Vahedi @ 2020-10-06 11:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Shahab Vahedi, Shahab Vahedi, Simon Marchi, Francois Bedard

From: Shahab Vahedi <shahab@synopsys.com>

The register_data() function in gdbserver/regcache.cc has an
input argument called "fetch".  This argument is not used by this
static function at all.  Therefore, it is time to get rid of it.

gdbserver/ChangeLog:

	* regache.cc (register_data): Remove "fetch" from arguments.
---
 gdbserver/regcache.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 6c0af95b34e..add826b2897 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -300,7 +300,7 @@ regcache_register_size (const struct regcache *regcache, int n)
 }
 
 static unsigned char *
-register_data (const struct regcache *regcache, int n, int fetch)
+register_data (const struct regcache *regcache, int n)
 {
   return (regcache->registers
 	  + find_register_by_number (regcache->tdesc, n).offset / 8);
@@ -319,7 +319,7 @@ regcache::raw_supply (int n, const void *buf)
 {
   if (buf)
     {
-      memcpy (register_data (this, n, 0), buf, register_size (tdesc, n));
+      memcpy (register_data (this, n), buf, register_size (tdesc, n));
 #ifndef IN_PROCESS_AGENT
       if (register_status != NULL)
 	register_status[n] = REG_VALID;
@@ -327,7 +327,7 @@ regcache::raw_supply (int n, const void *buf)
     }
   else
     {
-      memset (register_data (this, n, 0), 0, register_size (tdesc, n));
+      memset (register_data (this, n), 0, register_size (tdesc, n));
 #ifndef IN_PROCESS_AGENT
       if (register_status != NULL)
 	register_status[n] = REG_UNAVAILABLE;
@@ -340,7 +340,7 @@ regcache::raw_supply (int n, const void *buf)
 void
 supply_register_zeroed (struct regcache *regcache, int n)
 {
-  memset (register_data (regcache, n, 0), 0,
+  memset (register_data (regcache, n), 0,
 	  register_size (regcache->tdesc, n));
 #ifndef IN_PROCESS_AGENT
   if (regcache->register_status != NULL)
@@ -420,7 +420,7 @@ collect_register (struct regcache *regcache, int n, void *buf)
 void
 regcache::raw_collect (int n, void *buf) const
 {
-  memcpy (buf, register_data (this, n, 1), register_size (tdesc, n));
+  memcpy (buf, register_data (this, n), register_size (tdesc, n));
 }
 
 enum register_status
@@ -461,7 +461,7 @@ regcache_raw_get_unsigned_by_name (struct regcache *regcache,
 void
 collect_register_as_string (struct regcache *regcache, int n, char *buf)
 {
-  bin2hex (register_data (regcache, n, 1), buf,
+  bin2hex (register_data (regcache, n), buf,
 	   register_size (regcache->tdesc, n));
 }
 
@@ -508,7 +508,7 @@ regcache::raw_compare (int regnum, const void *buf, int offset) const
 {
   gdb_assert (buf != NULL);
 
-  const unsigned char *regbuf = register_data (this, regnum, 1);
+  const unsigned char *regbuf = register_data (this, regnum);
   int size = register_size (tdesc, regnum);
   gdb_assert (size >= offset);
 
-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] gdbserver: Remove unused argument in register_data()
  2020-10-06 11:20 [PATCH] gdbserver: Remove unused argument in register_data() Shahab Vahedi
@ 2020-10-06 12:16 ` Shahab Vahedi
  2020-10-06 13:29   ` Simon Marchi
  2020-10-06 15:25 ` [PUSHED] " Shahab Vahedi
  1 sibling, 1 reply; 4+ messages in thread
From: Shahab Vahedi @ 2020-10-06 12:16 UTC (permalink / raw)
  To: gdb-patches
  Cc: Shahab Vahedi, Shahab Vahedi, Simon Marchi, Baris Aktemur,
	Francois Bedard

From: Shahab Vahedi <shahab@synopsys.com>

The register_data() function in gdbserver/regcache.cc has an
input argument called "fetch".  This argument is not used by this
static function at all.  Therefore, it is time to get rid of it.

gdbserver/ChangeLog:

	* regcache.cc (register_data): Remove "fetch" from arguments.
---
 gdbserver/regcache.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 6c0af95b34e..add826b2897 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -300,7 +300,7 @@ regcache_register_size (const struct regcache *regcache, int n)
 }
 
 static unsigned char *
-register_data (const struct regcache *regcache, int n, int fetch)
+register_data (const struct regcache *regcache, int n)
 {
   return (regcache->registers
 	  + find_register_by_number (regcache->tdesc, n).offset / 8);
@@ -319,7 +319,7 @@ regcache::raw_supply (int n, const void *buf)
 {
   if (buf)
     {
-      memcpy (register_data (this, n, 0), buf, register_size (tdesc, n));
+      memcpy (register_data (this, n), buf, register_size (tdesc, n));
 #ifndef IN_PROCESS_AGENT
       if (register_status != NULL)
 	register_status[n] = REG_VALID;
@@ -327,7 +327,7 @@ regcache::raw_supply (int n, const void *buf)
     }
   else
     {
-      memset (register_data (this, n, 0), 0, register_size (tdesc, n));
+      memset (register_data (this, n), 0, register_size (tdesc, n));
 #ifndef IN_PROCESS_AGENT
       if (register_status != NULL)
 	register_status[n] = REG_UNAVAILABLE;
@@ -340,7 +340,7 @@ regcache::raw_supply (int n, const void *buf)
 void
 supply_register_zeroed (struct regcache *regcache, int n)
 {
-  memset (register_data (regcache, n, 0), 0,
+  memset (register_data (regcache, n), 0,
 	  register_size (regcache->tdesc, n));
 #ifndef IN_PROCESS_AGENT
   if (regcache->register_status != NULL)
@@ -420,7 +420,7 @@ collect_register (struct regcache *regcache, int n, void *buf)
 void
 regcache::raw_collect (int n, void *buf) const
 {
-  memcpy (buf, register_data (this, n, 1), register_size (tdesc, n));
+  memcpy (buf, register_data (this, n), register_size (tdesc, n));
 }
 
 enum register_status
@@ -461,7 +461,7 @@ regcache_raw_get_unsigned_by_name (struct regcache *regcache,
 void
 collect_register_as_string (struct regcache *regcache, int n, char *buf)
 {
-  bin2hex (register_data (regcache, n, 1), buf,
+  bin2hex (register_data (regcache, n), buf,
 	   register_size (regcache->tdesc, n));
 }
 
@@ -508,7 +508,7 @@ regcache::raw_compare (int regnum, const void *buf, int offset) const
 {
   gdb_assert (buf != NULL);
 
-  const unsigned char *regbuf = register_data (this, regnum, 1);
+  const unsigned char *regbuf = register_data (this, regnum);
   int size = register_size (tdesc, regnum);
   gdb_assert (size >= offset);
 
-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] gdbserver: Remove unused argument in register_data()
  2020-10-06 12:16 ` [PATCH v2] " Shahab Vahedi
@ 2020-10-06 13:29   ` Simon Marchi
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2020-10-06 13:29 UTC (permalink / raw)
  To: Shahab Vahedi, gdb-patches; +Cc: Shahab Vahedi, Baris Aktemur, Francois Bedard

On 2020-10-06 8:16 a.m., Shahab Vahedi wrote:
> From: Shahab Vahedi <shahab@synopsys.com>
> 
> The register_data() function in gdbserver/regcache.cc has an
> input argument called "fetch".  This argument is not used by this
> static function at all.  Therefore, it is time to get rid of it.
> 
> gdbserver/ChangeLog:
> 
> 	* regcache.cc (register_data): Remove "fetch" from arguments.

Thanks, this is OK.

Simon


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PUSHED] gdbserver: Remove unused argument in register_data()
  2020-10-06 11:20 [PATCH] gdbserver: Remove unused argument in register_data() Shahab Vahedi
  2020-10-06 12:16 ` [PATCH v2] " Shahab Vahedi
@ 2020-10-06 15:25 ` Shahab Vahedi
  1 sibling, 0 replies; 4+ messages in thread
From: Shahab Vahedi @ 2020-10-06 15:25 UTC (permalink / raw)
  To: gdb-patches
  Cc: Shahab Vahedi, Shahab Vahedi, Simon Marchi, Baris Aktemur,
	Francois Bedard

From: Shahab Vahedi <shahab@synopsys.com>

The register_data() function in gdbserver/regcache.cc has an
input argument called "fetch".  This argument is not used by this
static function at all.  Therefore, it is time to get rid of it.

gdbserver/ChangeLog:

	* regcache.cc (register_data): Remove unused "fetch" argument.
---
 gdbserver/ChangeLog   |  4 ++++
 gdbserver/regcache.cc | 14 +++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index 1f3652b6d5d..d4e8e52c74e 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,7 @@
+2020-10-06  Shahab Vahedi  <shahab@synopsys.com>
+
+	* regcache.cc (register_data): Remove unused "fetch" argument.
+
 2020-10-02  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* server.cc (handle_monitor_command): Handle "set
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 6c0af95b34e..add826b2897 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -300,7 +300,7 @@ regcache_register_size (const struct regcache *regcache, int n)
 }
 
 static unsigned char *
-register_data (const struct regcache *regcache, int n, int fetch)
+register_data (const struct regcache *regcache, int n)
 {
   return (regcache->registers
 	  + find_register_by_number (regcache->tdesc, n).offset / 8);
@@ -319,7 +319,7 @@ regcache::raw_supply (int n, const void *buf)
 {
   if (buf)
     {
-      memcpy (register_data (this, n, 0), buf, register_size (tdesc, n));
+      memcpy (register_data (this, n), buf, register_size (tdesc, n));
 #ifndef IN_PROCESS_AGENT
       if (register_status != NULL)
 	register_status[n] = REG_VALID;
@@ -327,7 +327,7 @@ regcache::raw_supply (int n, const void *buf)
     }
   else
     {
-      memset (register_data (this, n, 0), 0, register_size (tdesc, n));
+      memset (register_data (this, n), 0, register_size (tdesc, n));
 #ifndef IN_PROCESS_AGENT
       if (register_status != NULL)
 	register_status[n] = REG_UNAVAILABLE;
@@ -340,7 +340,7 @@ regcache::raw_supply (int n, const void *buf)
 void
 supply_register_zeroed (struct regcache *regcache, int n)
 {
-  memset (register_data (regcache, n, 0), 0,
+  memset (register_data (regcache, n), 0,
 	  register_size (regcache->tdesc, n));
 #ifndef IN_PROCESS_AGENT
   if (regcache->register_status != NULL)
@@ -420,7 +420,7 @@ collect_register (struct regcache *regcache, int n, void *buf)
 void
 regcache::raw_collect (int n, void *buf) const
 {
-  memcpy (buf, register_data (this, n, 1), register_size (tdesc, n));
+  memcpy (buf, register_data (this, n), register_size (tdesc, n));
 }
 
 enum register_status
@@ -461,7 +461,7 @@ regcache_raw_get_unsigned_by_name (struct regcache *regcache,
 void
 collect_register_as_string (struct regcache *regcache, int n, char *buf)
 {
-  bin2hex (register_data (regcache, n, 1), buf,
+  bin2hex (register_data (regcache, n), buf,
 	   register_size (regcache->tdesc, n));
 }
 
@@ -508,7 +508,7 @@ regcache::raw_compare (int regnum, const void *buf, int offset) const
 {
   gdb_assert (buf != NULL);
 
-  const unsigned char *regbuf = register_data (this, regnum, 1);
+  const unsigned char *regbuf = register_data (this, regnum);
   int size = register_size (tdesc, regnum);
   gdb_assert (size >= offset);
 
-- 
2.28.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-06 15:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 11:20 [PATCH] gdbserver: Remove unused argument in register_data() Shahab Vahedi
2020-10-06 12:16 ` [PATCH v2] " Shahab Vahedi
2020-10-06 13:29   ` Simon Marchi
2020-10-06 15:25 ` [PUSHED] " Shahab Vahedi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).