public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Alan Hayward <Alan.Hayward@arm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: nd <nd@arm.com>
Subject: [PATCH v2 1/8] Move tdesc header funcs to c file
Date: Wed, 24 Jan 2018 09:26:00 -0000	[thread overview]
Message-ID: <F3BCC32B-3E1E-4C50-A990-34B307306FD1@arm.com> (raw)
In-Reply-To: <7C97CC6A-92CB-4702-820D-206022F07102@arm.com>

Move the destructor and equals operator for gdbserver tdesc from the .h
to the .c file. Both functions are too long to be inlined and makes the
header look messy. Patch does not change any functionality.

Alan.

2018-01-24  Alan Hayward  <alan.hayward@arm.com>

gdbserver/
	* tdesc.c (target_desc::~target_desc): Move to here.
	(target_desc::operator==): Likewise.
	* tdesc.h (target_desc::~target_desc): Move from here.
	(target_desc::operator==): Likewise.


diff --git a/gdb/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h
index 783500598b5599e51f8e768a876fdfe499cdf0ef..705b968b98af9405682507acbcfb41356da62857 100644
--- a/gdb/gdbserver/tdesc.h
+++ b/gdb/gdbserver/tdesc.h
@@ -67,49 +67,9 @@ public:
     : registers_size (0)
   {}

-  ~target_desc ()
-  {
-    int i;
-
-    for (reg *reg : reg_defs)
-      xfree (reg);
-
-    xfree ((char *) arch);
-    xfree ((char *) osabi);
-
-    char *f;
+  ~target_desc ();

-    for (i = 0; VEC_iterate (char_ptr, features, i, f); i++)
-      xfree (f);
-    VEC_free (char_ptr, features);
-  }
-
-  bool operator== (const target_desc &other) const
-  {
-    if (reg_defs.size () != other.reg_defs.size ())
-      return false;
-
-    for (int i = 0; i < reg_defs.size (); ++i)
-      {
-	struct reg *reg = reg_defs[i];
-	struct reg *reg2 = other.reg_defs[i];
-
-	if (reg != reg2 && *reg != *reg2)
-	  return false;
-      }
-
-    /* Compare expedite_regs.  */
-    int i = 0;
-    for (; expedite_regs[i] != NULL; i++)
-      {
-	if (strcmp (expedite_regs[i], other.expedite_regs[i]) != 0)
-	  return false;
-      }
-    if (other.expedite_regs[i] != NULL)
-      return false;
-
-    return true;
-  }
+  bool operator== (const target_desc &other) const;

   bool operator!= (const target_desc &other) const
   {
diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c
index c39b5e7d27e879c5d3fb49b6e04d1eb6128f8eef..359ab97361c07ff2cbc2c8d5ff392c6233c329ff 100644
--- a/gdb/gdbserver/tdesc.c
+++ b/gdb/gdbserver/tdesc.c
@@ -19,6 +19,54 @@
 #include "tdesc.h"
 #include "regdef.h"

+#ifndef IN_PROCESS_AGENT
+
+target_desc::~target_desc ()
+{
+  int i;
+
+  for (reg *reg : reg_defs)
+    xfree (reg);
+
+  xfree ((char *) arch);
+  xfree ((char *) osabi);
+
+  char *f;
+
+  for (i = 0; VEC_iterate (char_ptr, features, i, f); i++)
+    xfree (f);
+  VEC_free (char_ptr, features);
+}
+
+bool target_desc::operator== (const target_desc &other) const
+{
+  if (reg_defs.size () != other.reg_defs.size ())
+    return false;
+
+  for (int i = 0; i < reg_defs.size (); ++i)
+    {
+      struct reg *reg = reg_defs[i];
+      struct reg *reg2 = other.reg_defs[i];
+
+      if (reg != reg2 && *reg != *reg2)
+	return false;
+    }
+
+  /* Compare expedite_regs.  */
+  int i = 0;
+  for (; expedite_regs[i] != NULL; i++)
+    {
+      if (strcmp (expedite_regs[i], other.expedite_regs[i]) != 0)
+	return false;
+    }
+  if (other.expedite_regs[i] != NULL)
+    return false;
+
+  return true;
+}
+
+#endif
+
 void
 init_target_desc (struct target_desc *tdesc)
 {


  reply	other threads:[~2018-01-24  9:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  9:26 [PATCH v2 0/8] Remove XML files from gdbserver Alan Hayward
2018-01-24  9:26 ` Alan Hayward [this message]
2018-01-24  9:27 ` [PATCH v2 2/8] Use tdesc_reg in gxdbserver tdesc Alan Hayward
2018-01-25 13:12   ` Philipp Rudo
2018-01-24  9:28 ` [PATCH v2 4/8] Move make_gdb_type functions within file Alan Hayward
2018-01-24  9:28 ` [PATCH v2 3/8] Use tdesc_feature in gdbserver tdesc Alan Hayward
2018-01-25 13:12   ` Philipp Rudo
2018-01-24  9:29 ` [PATCH v2 5/8] Use tdesc types " Alan Hayward
2018-01-25 13:13   ` Philipp Rudo
2018-01-29  7:28     ` Omair Javaid
2018-01-29 11:01       ` Alan Hayward
2018-01-29 11:31         ` Philipp Rudo
2018-01-29 15:52           ` Alan Hayward
2018-01-24  9:30 ` [PATCH v2 6/8] Create xml from target descriptions Alan Hayward
2018-01-25 13:14   ` Philipp Rudo
2018-01-25 15:45     ` Yao Qi
2018-01-25 16:13       ` Alan Hayward
2018-01-25 16:56         ` Philipp Rudo
2018-01-24  9:31 ` [PATCH v2 7/8]: Remove xml file references " Alan Hayward
2018-01-24  9:32 ` [PATCH v2 8/8] Remove xml files from gdbserver Alan Hayward
2018-01-24 10:57 ` [PATCH v2 0/8] Remove XML " Omair Javaid
2018-01-24 12:29   ` Alan Hayward
2018-01-24 14:44     ` Omair Javaid
2018-01-24 18:53       ` Alan Hayward
2018-01-25 13:11 ` Philipp Rudo
2018-01-26 22:31   ` Omair Javaid
2018-01-29 16:28     ` Yao Qi
2018-01-29 17:13       ` Alan Hayward
2018-01-31 11:28         ` Alan Hayward
2018-01-31 11:43           ` Omair Javaid
2018-01-29 18:18 ` Pedro Alves
2018-01-30 12:16   ` Alan Hayward

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=F3BCC32B-3E1E-4C50-A990-34B307306FD1@arm.com \
    --to=alan.hayward@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).