From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88366 invoked by alias); 23 Nov 2016 22:23:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 88353 invoked by uid 89); 23 Nov 2016 22:23:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=sk:set_gdb, Hx-languages-length:3121 X-HELO: mail-pg0-f67.google.com Received: from mail-pg0-f67.google.com (HELO mail-pg0-f67.google.com) (74.125.83.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Nov 2016 22:23:18 +0000 Received: by mail-pg0-f67.google.com with SMTP id p66so1943940pga.2 for ; Wed, 23 Nov 2016 14:23:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y/GZHBou8lJKNn13Y2Xvp7dVUv8W05xSqe7c8KuFYtU=; b=i9M2MnbFRJZTcutHHF7leZG9q+fFNcakfAroan8o9MP6dSVG47nj4Gg9wrHlwSjvnV 0n25osGfoDF8auC8JOvv6YzkMiw0KFC7gE4in4Re8R6tvS7lx5jTfG4s7EbhvRyTQ38r lcaLuXaSPC0fW28+spBkIEXYXUdNaDoWzF8uJWwkIT70CxmUgA27P/v9vnYGcsYbq3jo SgVzKW0WIKzjhxQjho1nkY0WnG6dTzLSQ+rNybeGQ1ZQkizdLFE2a5qINO/YG4/l3Ot3 kGsK79q1Haw0qH7/vVEIoi+6bDAy+tfwYdjpTTRpq6ntgOoEFxmS0hXkfZ4M9JtBy49q bANQ== X-Gm-Message-State: AKaTC020MdEFBoZQWD38wfrZE38cjwOjmrkXLOBoCTg+v1dSJKy/5GAIJBYBTwKezqkkxg== X-Received: by 10.99.108.8 with SMTP id h8mr8760150pgc.93.1479939081286; Wed, 23 Nov 2016 14:11:21 -0800 (PST) Received: from lianli.shorne-pla.net (z14.124-44-185.ppp.wakwak.ne.jp. [124.44.185.14]) by smtp.gmail.com with ESMTPSA id v76sm54944289pfk.77.2016.11.23.14.11.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2016 14:11:20 -0800 (PST) Received: from lianli.shorne-pla.net (localhost [127.0.0.1]) by lianli.shorne-pla.net (8.15.2/8.15.2) with ESMTPS id uANMBH8d001553 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 24 Nov 2016 07:11:17 +0900 Received: (from shorne@localhost) by lianli.shorne-pla.net (8.15.2/8.15.2/Submit) id uANMBGIb001549; Thu, 24 Nov 2016 07:11:16 +0900 From: Stafford Horne To: gdb-patches@sourceware.org Cc: openrisc@lists.librecores.org, Stafford Horne Subject: [PATCH 18/18] gdb: or1k: Refactor to new bp_kind_from_pc and pb_from_kind Date: Wed, 23 Nov 2016 22:23:00 -0000 Message-Id: <1479939044-1341-19-git-send-email-shorne@gmail.com> In-Reply-To: <1479939044-1341-1-git-send-email-shorne@gmail.com> References: <1479939044-1341-1-git-send-email-shorne@gmail.com> X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00729.txt.bz2 Updates to mirror refactorings by Yao Qi in cd6c3b4ffc. New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind gdb/ChangeLog: * or1k-tdep.c (or1k_breakpoint_kind_from_pc): New function (or1k_sw_breakpoint_from_kind): New function (or1k_breakpoint_from_pc): Remove --- gdb/or1k-tdep.c | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c index 5aa0e7c..dfaee96 100644 --- a/gdb/or1k-tdep.c +++ b/gdb/or1k-tdep.c @@ -124,6 +124,14 @@ +/* Enum describing different kinds of breakpoints for or1k */ + +enum or1k_breakpoint_kind +{ + /* 32-bit standard OpenRISC breakpoint */ + OR1K_BP_KIND_OR1K = 2, +}; + /* The gdbarch_tdep structure. */ /*! OR1K specific per-architecture information. Replaces @@ -526,6 +534,25 @@ or1k_return_value (struct gdbarch *gdbarch, } /* or1k_return_value() */ + +/*----------------------------------------------------------------------------*/ +/*!Determine the kind of breakpoint based on the current pc + + Given the pc address, return the type of breapoint that should be used. + For or1k we only use one type which is a 32-bit trap instruction. + + @param[in] gdbarch The GDB architecture being used + @param[in] pcptr The program counter address in question + + @return The breakpoint type */ +/*----------------------------------------------------------------------------*/ + +static int +or1k_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr) +{ + return OR1K_BP_KIND_OR1K; +} /* or1k_breakpoint_kind_from_pc() */ + /*----------------------------------------------------------------------------*/ /*!Determine the instruction to use for a breakpoint. @@ -543,16 +570,22 @@ or1k_return_value (struct gdbarch *gdbarch, /*---------------------------------------------------------------------------*/ static const gdb_byte * -or1k_breakpoint_from_pc (struct gdbarch *gdbarch, - CORE_ADDR *bp_addr, - int *bp_size) +or1k_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size) { - static const gdb_byte breakpoint[] = OR1K_BRK_INSTR_STRUCT; - *bp_size = OR1K_INSTLEN; - return breakpoint; - -} /* or1k_breakpoint_from_pc() */ + switch (kind) + { + case OR1K_BP_KIND_OR1K: + { + static const gdb_byte breakpoint[] = OR1K_BRK_INSTR_STRUCT; + + *size = OR1K_INSTLEN; + return breakpoint; + } + default: + gdb_assert_not_reached ("unexpected or1k breakpoint kind"); + }; +} /* or1k_sw_breakpoint_from_kind() */ /*----------------------------------------------------------------------------*/ @@ -2056,7 +2089,8 @@ or1k_gdbarch_init (struct gdbarch_info info, /* Information about the target architecture */ set_gdbarch_return_value (gdbarch, or1k_return_value); - set_gdbarch_breakpoint_from_pc (gdbarch, or1k_breakpoint_from_pc); + set_gdbarch_breakpoint_kind_from_pc (gdbarch, or1k_breakpoint_kind_from_pc); + set_gdbarch_sw_breakpoint_from_kind (gdbarch, or1k_sw_breakpoint_from_kind); set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1); -- 2.7.4