From patchwork Wed Aug 31 15:05:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 15120 Received: (qmail 95363 invoked by alias); 31 Aug 2016 15:06: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 95223 invoked by uid 89); 31 Aug 2016 15:06:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=0x40 X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 Aug 2016 15:06:12 +0000 Received: by mail-pf0-f196.google.com with SMTP id h186so2897462pfg.2 for ; Wed, 31 Aug 2016 08:06:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XFLFkjCEiXApuwN1T1Zrou2+ZxanlzJT+D5ozrBicxs=; b=hUmR8ar4CxFEZzYIdAfcYEaNjGa66NVrj8iHkPlYKOf4+Q5GIhxevdArywW6E0Ljts gnSG8Zk645WTohpIJtzQTABVl2s51w6FeIpaPWbYImzhfZPKiD5+nip6TPfHksFevSTW ogo8lZBabK/9HH2GP7S3HFxM5V47wCj6CYUFdHUskHUwZZfZmD0SysaG1ptwIivBXbxP PZY+sbYA6eVYSq4SL8mKEXCvwGlD2ZKxhO41CO9yJlWtgN38ceH8U7bfpJb66+ZbyKlY tAVei6w3h/3TAKVmqE7dbKosHNVWO+/KEJUu7Bb94DqtjsT5PJFxhL16G6ecDbIIGy+D Eybw== X-Gm-Message-State: AE9vXwM9iWN547Ef66aD5bqxgANf8pDTk/jqt39qTAroR8RdlGLfFjKmrNIanBfsl5VeIw== X-Received: by 10.98.8.142 with SMTP id 14mr17608869pfi.57.1472655971154; Wed, 31 Aug 2016 08:06:11 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc115.osuosl.org. [140.211.9.73]) by smtp.gmail.com with ESMTPSA id c125sm464809pfc.40.2016.08.31.08.06.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Aug 2016 08:06:10 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 01/13] Remove v850_dbtrap_breakpoint_from_pc Date: Wed, 31 Aug 2016 16:05:53 +0100 Message-Id: <1472655965-12212-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1472655965-12212-1-git-send-email-yao.qi@linaro.org> References: <1472655965-12212-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes v850 has two functions to install to gdbarch_breakpoint_from_pc, and it selects one according to info.bfd_arch_info->mach. However, we can select the kind/length of breakpoint instruction inside v850_breakpoint_from_pc by gdbarch_bfd_arch_info (gdbarch)->mach. This patch is to do that, and remove v850_dbtrap_breakpoint_from_pc. gdb: 2016-08-30 Yao Qi * v850-tdep.c (v850_breakpoint_from_pc): Use the right breakpoint instruction. (v850_dbtrap_breakpoint_from_pc): Remove. (v850_gdbarch_init): Update. --- gdb/v850-tdep.c | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index 0b50580..d03334e 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -1170,26 +1170,33 @@ v850_return_value (struct gdbarch *gdbarch, struct value *function, static const unsigned char * v850_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, - int *lenptr) + int *lenptr) { - static unsigned char breakpoint[] = { 0x85, 0x05 }; + *lenptr = 2; - *lenptr = sizeof (breakpoint); - return breakpoint; -} + switch (gdbarch_bfd_arch_info (gdbarch)->mach) + { + case bfd_mach_v850e2: + case bfd_mach_v850e2v3: + case bfd_mach_v850e3v5: + { + /* Implement software breakpoints by using the dbtrap instruction. + Older architectures had no such instruction. For those, an + unconditional branch to self instruction is used. */ -/* Implement software breakpoints by using the dbtrap instruction. - Older architectures had no such instruction. For those, an - unconditional branch to self instruction is used. */ + static unsigned char dbtrap_breakpoint[] = { 0x40, 0xf8 }; -static const unsigned char * -v850_dbtrap_breakpoint_from_pc (struct gdbarch *gdbarch, - CORE_ADDR *pcptr, int *lenptr) -{ - static unsigned char breakpoint[] = { 0x40, 0xf8 }; + return dbtrap_breakpoint; + } + break; + default: + { + static unsigned char breakpoint[] = { 0x85, 0x05 }; - *lenptr = sizeof (breakpoint); - return breakpoint; + return breakpoint; + } + break; + } } static struct v850_frame_cache * @@ -1440,18 +1447,8 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - switch (info.bfd_arch_info->mach) - { - case bfd_mach_v850e2: - case bfd_mach_v850e2v3: - case bfd_mach_v850e3v5: - set_gdbarch_breakpoint_from_pc (gdbarch, v850_dbtrap_breakpoint_from_pc); - break; - default: - set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc); - break; - } + set_gdbarch_breakpoint_from_pc (gdbarch, v850_breakpoint_from_pc); set_gdbarch_return_value (gdbarch, v850_return_value); set_gdbarch_push_dummy_call (gdbarch, v850_push_dummy_call); set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);