From patchwork Tue Jan 10 12:26:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 18837 Received: (qmail 90115 invoked by alias); 10 Jan 2017 12:26:43 -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 89784 invoked by uid 89); 10 Jan 2017 12:26:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=H*RU:209.85.192.193, Hx-spam-relays-external:209.85.192.193, 12819 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pf0-f193.google.com Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Jan 2017 12:26:31 +0000 Received: by mail-pf0-f193.google.com with SMTP id f144so9892805pfa.2; Tue, 10 Jan 2017 04:26:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=APRV6BhoZYOH2ZDPrKQ6HWmWMHJtPN3D/cHYHg2xiuI=; b=YIXBO782B6bqUmdbqgPi1nL9rLiIFi2+FEx//9ePtwWVi3qLsAR2xGtIfF63Cxg1mS k9ex3KiTjOXrfa0K1k3FYjMh8elYw4z3bzxwZ8XIB34mDhvqw6JkXBEUjNYES/3jruFs fHVkdj5hHA/sMEpvk4PB4mxA9WCHuP5uQHY6exYZLhK0vSuvC2UucsY3sSD4emUBzlQ+ e1jdai9hYjrvxHPUI/dciy/BGTMJR4mnTdpPeHIlg+9L04tgnlU7Ppq/HvIeSmbBWvwK 6rMl2sNtv8YGVruSBLDGqwET4bjSTwFDiIj1nvM0gXXbwDZuIayW9GZkGNqlsIY9OXHA sUdQ== X-Gm-Message-State: AIkVDXLcr54VVS6OV2Nil5956+FpYx3E0ABtsPDhh18fGZI0HlQFbe9VmwK6n7Kcwwm1ZQ== X-Received: by 10.98.72.129 with SMTP id q1mr3476755pfi.169.1484051190224; Tue, 10 Jan 2017 04:26:30 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id r26sm5450661pgd.42.2017.01.10.04.26.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Jan 2017 04:26:29 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH 2/8] Call print_insn_mep in mep_gdb_print_insn Date: Tue, 10 Jan 2017 12:26:12 +0000 Message-Id: <1484051178-16013-3-git-send-email-yao.qi@linaro.org> In-Reply-To: <1484051178-16013-1-git-send-email-yao.qi@linaro.org> References: <1484051178-16013-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes opcodes/mep-dis.c:mep_print_insn has already had the code to handle the case when info->section is NULL, /* Picking the right ISA bitmask for the current context is tricky. */ if (info->section) { } else /* sid or gdb */ { } so that we can still cal print_insn_mep even section can't be found. On the other hand, user can disassemble an arbitrary address which doesn't map to any section at all. gdb: 2017-01-10 Yao Qi * mep-tdep.c (mep_gdb_print_insn): Set info->arch to bfd_arch_mep. Don't return 0 if section is not found. Call print_insn_mep. --- gdb/mep-tdep.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 68b0c4b..7d04983 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1273,6 +1273,7 @@ mep_gdb_print_insn (bfd_vma pc, disassemble_info * info) { struct obj_section * s = find_pc_section (pc); + info->arch = bfd_arch_mep; if (s) { /* The libopcodes disassembly code uses the section to find the @@ -1280,12 +1281,9 @@ mep_gdb_print_insn (bfd_vma pc, disassemble_info * info) the me_module index, and the me_module index to select the right instructions to print. */ info->section = s->the_bfd_section; - info->arch = bfd_arch_mep; - - return print_insn_mep (pc, info); } - - return 0; + + return print_insn_mep (pc, info); }