aboutsummaryrefslogtreecommitdiff
path: root/gdb/regformats
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-09-05 09:54:53 +0100
committerYao Qi <yao.qi@linaro.org>2017-09-05 09:54:53 +0100
commit0a188386c032126045979b7fb7c238d715c81eb5 (patch)
tree7a34674b979bf52bd421901a608bfad9417f9e5a /gdb/regformats
parentf49ff00066929bf7c38f9c89ad640561bbb331f6 (diff)
downloadgdb-0a188386c032126045979b7fb7c238d715c81eb5.zip
gdb-0a188386c032126045979b7fb7c238d715c81eb5.tar.gz
gdb-0a188386c032126045979b7fb7c238d715c81eb5.tar.bz2
[GDBserver] unit test to i386_tdesc
This patch adds a unit test in GDBserver to test dynamically created target descriptions equal these pre-generated ones. gdb/gdbserver: 2017-09-05 Yao Qi <yao.qi@linaro.org> * linux-x86-tdesc.c: Include selftest.h. (i386_tdesc_test): New function. (initialize_low_tdesc): Call selftests::register_test. * tdesc.h: Include regdef.h. (target_desc): Override operator == and !=. gdb: 2017-09-05 Yao Qi <yao.qi@linaro.org> * regformats/regdef.h (struct reg): Override operator == and !=.
Diffstat (limited to 'gdb/regformats')
-rw-r--r--gdb/regformats/regdef.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/regformats/regdef.h b/gdb/regformats/regdef.h
index de7a010..ff1d40b 100644
--- a/gdb/regformats/regdef.h
+++ b/gdb/regformats/regdef.h
@@ -34,6 +34,18 @@ struct reg
/* The size (in bits) of the value of this register, as transmitted. */
int size;
+
+ bool operator== (const reg &other) const
+ {
+ return (strcmp (name, other.name) == 0
+ && offset == other.offset
+ && size == other.size);
+ }
+
+ bool operator!= (const reg &other) const
+ {
+ return !(*this == other);
+ }
};
#endif /* REGDEF_H */