From patchwork Mon Jan 16 10:02:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 18911 Received: (qmail 53108 invoked by alias); 16 Jan 2017 10:03:24 -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 53074 invoked by uid 89); 16 Jan 2017 10:03:23 -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=Picking, sid 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; Mon, 16 Jan 2017 10:03:16 +0000 Received: by mail-pf0-f193.google.com with SMTP id e4so3548501pfg.0 for ; Mon, 16 Jan 2017 02:03:16 -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=abNc1zw1Pxx9MZs+wc1uPLW3F4NFqnEPD9eEUk/9d1c=; b=h4kzwEbpVQzLVYSQnw3sGUTYowX5joiXLjRGnfhoDYb6d1owuaXzmnHuy/NwajB8FJ JsnkQgmW0CLG96+K3WxUdFHLMDY3LItr9hexerZGGlwGzo/zY716OLrEUHtZ5buEhjh3 mh1Y3HFUaFWMaG7lmNPHNxL3udxTfjzVfSgR9ZqeoLYSTHnvwVljfsEoQNOCFrTHpc90 2CmBpY3Ud5/FBc/qWF8KA5imuovQvAZ/3iagWxeGKsYi44mcdzr3Q1YV/FW9PYPuJstS VUEx9ojHG+BOHEXUhAH3JGlk1ZjRCLACmQ+M8zK6ieH6N7H8jW6mXAEIV7T5JcjSAlp2 uJuA== X-Gm-Message-State: AIkVDXLaR8QMmy3xsTQl0XMdxf+VSnySBXehv9jBwHma0V4LAi9BvMgofw/181jCdz3K3Q== X-Received: by 10.99.66.198 with SMTP id p189mr38944548pga.30.1484560994744; Mon, 16 Jan 2017 02:03:14 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id g28sm9695206pgn.3.2017.01.16.02.03.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 02:03:14 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 3/6] Call print_insn_mep in mep_gdb_print_insn Date: Mon, 16 Jan 2017 10:02:54 +0000 Message-Id: <1484560977-8693-4-git-send-email-yao.qi@linaro.org> In-Reply-To: <1484560977-8693-1-git-send-email-yao.qi@linaro.org> References: <1484051178-16013-1-git-send-email-yao.qi@linaro.org> <1484560977-8693-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 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 68b0c4b..b1dcc86 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1266,13 +1266,12 @@ mep_pseudo_register_write (struct gdbarch *gdbarch, /* Disassembly. */ -/* The mep disassembler needs to know about the section in order to - work correctly. */ static int 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 +1279,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); }