diff options
author | Alan Hayward <alan.hayward@arm.com> | 2018-03-23 09:29:42 +0000 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2018-03-23 11:08:27 +0000 |
commit | d80e524238a17878eee0c620d56e2fad072556bc (patch) | |
tree | 79b81e2dee925c0ad97d2eabb78dc455ed2e0add /gdb | |
parent | 079670b94ade4b5792fa74b29a6b5b4626f27185 (diff) | |
download | gdb-d80e524238a17878eee0c620d56e2fad072556bc.zip gdb-d80e524238a17878eee0c620d56e2fad072556bc.tar.gz gdb-d80e524238a17878eee0c620d56e2fad072556bc.tar.bz2 |
Move gdbserver tdesc header funcs to c file
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/tdesc.c | 48 | ||||
-rw-r--r-- | gdb/gdbserver/tdesc.h | 44 |
3 files changed, 57 insertions, 42 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index bd3e6a0..093eec7 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2018-03-23 Alan Hayward <alan.hayward@arm.com> + + * 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. + 2018-03-22 Andreas Arnez <arnez@linux.vnet.ibm.com> * linux-s390-low.c (s390_get_wordsize): Correct brace style. diff --git a/gdb/gdbserver/tdesc.c b/gdb/gdbserver/tdesc.c index 00a5e8d..e50a848 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) { diff --git a/gdb/gdbserver/tdesc.h b/gdb/gdbserver/tdesc.h index d21574c..4513ea7 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 { |