aboutsummaryrefslogtreecommitdiff
path: root/gdb/arc-tdep.h
diff options
context:
space:
mode:
authorAnton Kolesov <Anton.Kolesov@synopsys.com>2017-06-27 19:12:14 +0300
committerAnton Kolesov <Anton.Kolesov@synopsys.com>2017-10-11 15:42:52 +0300
commit56d704daee44b036d1eff86123de6dec0c55f61b (patch)
tree291f870c905a27d3e6bd035b24c16e36f10a28cf /gdb/arc-tdep.h
parent8f314ad58ec824ce6c8467af29f11583f79a80ea (diff)
downloadgdb-56d704daee44b036d1eff86123de6dec0c55f61b.zip
gdb-56d704daee44b036d1eff86123de6dec0c55f61b.tar.gz
gdb-56d704daee44b036d1eff86123de6dec0c55f61b.tar.bz2
arc: Pass proper CPU value to the disassembler
There was a problem with generation of the disassembler options for ARC in GDB, because a BFD architecture name was used as a CPU name, but they have different meaning even if some architectures have same name as respective CPUs. Target description specifies a BFD architecture, which is different from ARC CPU, as accepted by the disassembler (and most other ARC tools), because CPU values are much more fine grained - there can be multiple CPU values per single BFD architecture. As a result this code should translate architecture to some CPU value. Since there is no info on exact CPU configuration, it is best to use the most feature-rich CPU, so that the disassembler will recognize all instructions available to the specified architecture. gdb/ChangeLog yyyy-mm-dd Anton Kolesov <Anton.Kolesov@synopsys.com> * arc-tdep.c (arc_gdbarch_init): Pass proper cpu value to disassembler. * arc-tdep.h (arc_arch_is_em): New function. (arc_arch_is_hs): Likewise. gdb/testsuite/ChangeLog yyyy-mm-dd Anton Kolesov <Anton.Kolesov@synopsys.com> * gdb.arch/arc-tdesc-cpu.exp: New file. * gdb.arch/arc-tdesc-cpu.xml: Likewise.
Diffstat (limited to 'gdb/arc-tdep.h')
-rw-r--r--gdb/arc-tdep.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h
index 1bf1817..580ccb7 100644
--- a/gdb/arc-tdep.h
+++ b/gdb/arc-tdep.h
@@ -123,6 +123,21 @@ arc_mach_is_arcv2 (struct gdbarch *gdbarch)
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_arc_arcv2;
}
+/* ARC EM and ARC HS are unique BFD arches, however they share the same machine
+ number as "ARCv2". */
+
+static inline bool
+arc_arch_is_hs (const struct bfd_arch_info* arch)
+{
+ return startswith (arch->printable_name, "HS");
+}
+
+static inline bool
+arc_arch_is_em (const struct bfd_arch_info* arch)
+{
+ return startswith (arch->printable_name, "EM");
+}
+
/* Function to access ARC disassembler. Underlying opcodes disassembler will
print an instruction into stream specified in the INFO, so if it is
undesired, then this stream should be set to some invisible stream, but it