From patchwork Tue Feb 14 10:01:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Kolesov X-Patchwork-Id: 19249 Received: (qmail 97818 invoked by alias); 14 Feb 2017 10:01:48 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 97770 invoked by uid 89); 14 Feb 2017 10:01:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.7 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=bfd_vma, *info, print_insn, H*RU:sk:smtprel X-HELO: smtprelay.synopsys.com Received: from us01smtprelay-2.synopsys.com (HELO smtprelay.synopsys.com) (198.182.60.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Feb 2017 10:01:37 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id BD0AC10C1409 for ; Tue, 14 Feb 2017 02:01:36 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id A44D7222; Tue, 14 Feb 2017 02:01:36 -0800 (PST) Received: from akolesov-lab.internal.synopsys.com (akolesov-lab.internal.synopsys.com [10.121.8.134]) by mailhost.synopsys.com (Postfix) with ESMTP id A92B81F3; Tue, 14 Feb 2017 02:01:35 -0800 (PST) From: Anton Kolesov To: gdb-patches@sourceware.org Cc: Anton Kolesov , Francois Bedard Subject: [PATCH 2/5] arc: Set section to ".text" when disassembling Date: Tue, 14 Feb 2017 13:01:27 +0300 Message-Id: <20170214100130.29194-2-Anton.Kolesov@synopsys.com> In-Reply-To: <20170214100130.29194-1-Anton.Kolesov@synopsys.com> 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 * 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); }