From: Alan Hayward <Alan.Hayward@arm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: nd <nd@arm.com>
Subject: [PATCH V3 1/8] Move tdesc header funcs to c file
Date: Thu, 01 Mar 2018 11:39:00 -0000 [thread overview]
Message-ID: <40C6E308-3401-49D3-B47C-EE5F597F84C5@arm.com> (raw)
In-Reply-To: <757A8B89-2EF0-46BD-BAA6-6E668538B17F@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 make the
header look messy. Patch does not change any functionality.
2018-03-01 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 d21574ca73e5042d560adad0e3839e89ee2c67ab..4513ea74232a456cc86eb9a655904012ff117373 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 00a5e8dc4d6fe3c0809194c04902f96056622c82..e50a848e2f9f280a84ab139cfce4d1f17bd05884 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)
{
next prev parent reply other threads:[~2018-03-01 11:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 11:38 [PATCH V3 0/8] Remove gdbserver dependency on xml files Alan Hayward
2018-03-01 11:39 ` [PATCH v3 2/8] Commonise tdesc_reg Alan Hayward
2018-03-12 17:20 ` Philipp Rudo
2018-03-01 11:39 ` Alan Hayward [this message]
2018-03-01 11:40 ` [PATCH v3 4/8] Commonise tdesc types Alan Hayward
2018-03-01 11:40 ` [PATCH v3 5/8] Add tdesc osabi and architecture functions Alan Hayward
2018-03-01 11:40 ` [PATCH v3 3/8] Commonise tdesc_feature Alan Hayward
2018-03-12 17:20 ` Philipp Rudo
2018-03-01 11:41 ` [PATCH v3 6/8] Create xml from target descriptions Alan Hayward
2018-03-12 17:20 ` Philipp Rudo
2018-03-13 18:05 ` Philipp Rudo
2018-03-14 10:09 ` Alan Hayward
2018-03-01 11:41 ` [PATCH v3 8/8] Remove xml files from gdbserver Alan Hayward
2018-03-01 11:41 ` [PATCH v3 7/8]: Remove xml file references from target descriptions Alan Hayward
2018-03-09 8:21 ` [PATCH V3 0/8] Remove gdbserver dependency on xml files Alan Hayward
2018-03-12 14:05 ` Omair Javaid
2018-03-12 17:19 ` Philipp Rudo
2018-03-13 10:17 ` Alan Hayward
2018-03-13 17:58 ` Philipp Rudo
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=40C6E308-3401-49D3-B47C-EE5F597F84C5@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