This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/5] arc: Set section to ".text" when disassembling
- From: Anton Kolesov <Anton dot Kolesov at synopsys dot com>
- To: gdb-patches at sourceware dot org
- Cc: Anton Kolesov <Anton dot Kolesov at synopsys dot com>, Francois Bedard <Francois dot Bedard at synopsys dot com>
- Date: Tue, 14 Feb 2017 13:01:27 +0300
- Subject: [PATCH 2/5] arc: Set section to ".text" when disassembling
- Authentication-results: sourceware.org; auth=none
- References: <20170214100130.29194-1-Anton.Kolesov@synopsys.com>
ARC disassembler requires that disassemble_info->section is valid - it will be
used to access program headers of ELF files that is needed to distinguish
between ARC EM and HS (ARC600, ARC700 and ARC v2 can be distinguished by BFD's
`mach` attribute). Without this information disassembler will default to ARC
EM for ARC v2 targets, and it will not recognize instructions specific to ARC
HS, for example, double-word store and load.
gdb/ChangeLog:
yyyy-mm-dd Anton Kolesov <anton.kolesov@synopsys.com>
* arc-tdep.c (arc_delayed_print_insn): Set info->section.
---
gdb/arc-tdep.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index f78e3a9..e4b2e7a 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -705,6 +705,16 @@ arc_delayed_print_insn (bfd_vma addr, struct disassemble_info *info)
will handle NULL value gracefully. */
print_insn = arc_get_disassembler (exec_bfd);
gdb_assert (print_insn != NULL);
+
+ /* ARC disassembler requires that info->section is valid - it will be used to
+ access program headers of ELF files that is needed to distinguish between
+ ARC EM and HS (ARC600, ARC700 and ARC v2 can be distinguished by BFD's
+ `mach` attribute). Without this information disassembler will default to
+ ARC EM for ARC v2 targets, and it will not recognize instructions specific
+ to ARC HS, for example, double-word store and load. */
+ if (exec_bfd != NULL)
+ info->section = bfd_get_section_by_name (exec_bfd, ".text");
+
return print_insn (addr, info);
}
--
2.8.3