From patchwork Wed Jan 31 15:41:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 25713 Received: (qmail 129952 invoked by alias); 31 Jan 2018 15:41:23 -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 129926 invoked by uid 89); 31 Jan 2018 15:41:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=9127, HX-Received:sk:t184mr1, HX-Received:10.28.220.193, sk:dwarf2_ X-HELO: mail-wm0-f66.google.com Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 Jan 2018 15:41:21 +0000 Received: by mail-wm0-f66.google.com with SMTP id r78so8913678wme.0 for ; Wed, 31 Jan 2018 07:41:20 -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; bh=J1gE0GPqavYOdasFW4kQtTadrZnJsv5XIr4txTA/HtM=; b=FBk510pf8J/5R4FtLamTCr0sgbFZ9Pa0HfUwcTeFs3NkGWNbC+TuIdKZfa1CMYTsnF N13RmK4DsyXWkpWNf16Ck3f7zjoIT5/ouosd41AKo7cpvVwM6WryBW5CNFFOuMujBrxD NHdgvVFnBeDGgxDhuqG7EyQIsjT9XSFCr9w4VoAdODtBd8ug+fCQ/7twhAXVEsfLVecj Uoy9N6YtGn9ZDXOhAGox1YIBkU+L6Ay2j0Z11dpVD+VrYYW1O9z8Dvg4jRfM9ofE85Gl R330mxRprGYEW0upwfarRmehUFtWAl5pXUmWAhfLGDzKEURGRN//mZoFnCjL9hxBlDcB bNaQ== X-Gm-Message-State: AKwxyteZdtupnzyspElFBSt2lJEerN82u/EKjbHyZ3wbzpwUCELhg6or ighpaQQNgMg8wZEV3Qz25HJO6g== X-Google-Smtp-Source: AH8x224Z2A4Lj28zLBymWNQzI81E5khLbN1XoZHGzwKNdSEsfEBDFZEOgVXz2+sAbac/zZ9ruD38pg== X-Received: by 10.28.220.193 with SMTP id t184mr19488099wmg.126.1517413278762; Wed, 31 Jan 2018 07:41:18 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id 72sm4211wmh.44.2018.01.31.07.41.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Jan 2018 07:41:18 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] Remove some $ARCH_read_pc and $ARCH_write_pc Date: Wed, 31 Jan 2018 15:41:15 +0000 Message-Id: <1517413275-3641-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes Nowadays, gdbarch_read_pc is called in this way, if (gdbarch_read_pc_p (gdbarch)) pc_val = gdbarch_read_pc (gdbarch, regcache); /* Else use per-frame method on get_current_frame. */ else if (gdbarch_pc_regnum (gdbarch) >= 0) { ULONGEST raw_val; if (regcache_cooked_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch), &raw_val) == REG_UNAVAILABLE) some ports don't have to define its own gdbarch read_pc method if the pc value is simply a unsigned value from "pc" register. The same rule applies to regcache_write_pc. This patch removes these $ARCH_read_pc and $ARCH_write_pc functions. gdb: 2018-01-31 Yao Qi * ft32-tdep.c (ft32_read_pc): Remove. (ft32_write_pc): Remove. (ft32_gdbarch_init): Update. * m32r-tdep.c (m32r_read_pc): Remove. (m32r_gdbarch_init): Update. * mep-tdep.c (mep_read_pc): Remove. (mep_gdbarch_init): Update. * microblaze-tdep.c (microblaze_write_pc): Remove. (microblaze_gdbarch_init): Update. * mn10300-tdep.c (mn10300_read_pc): Remove. (mn10300_write_pc): Remove. (mn10300_gdbarch_init): Update. * moxie-tdep.c (moxie_read_pc): Remove. (moxie_write_pc): Remove. (moxie_gdbarch_init): Update. --- gdb/ft32-tdep.c | 22 ---------------------- gdb/m32r-tdep.c | 9 --------- gdb/mep-tdep.c | 10 ---------- gdb/microblaze-tdep.c | 7 ------- gdb/mn10300-tdep.c | 16 ---------------- gdb/moxie-tdep.c | 21 --------------------- 6 files changed, 85 deletions(-) diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index fc4b9ef..7198b84 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -383,26 +383,6 @@ ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch, return 0; } - -/* Implement the "read_pc" gdbarch method. */ - -static CORE_ADDR -ft32_read_pc (struct regcache *regcache) -{ - ULONGEST pc; - - regcache_cooked_read_unsigned (regcache, FT32_PC_REGNUM, &pc); - return pc; -} - -/* Implement the "write_pc" gdbarch method. */ - -static void -ft32_write_pc (struct regcache *regcache, CORE_ADDR val) -{ - regcache_cooked_write_unsigned (regcache, FT32_PC_REGNUM, val); -} - /* Implement the "unwind_sp" gdbarch method. */ static CORE_ADDR @@ -622,8 +602,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) func_void_type); TYPE_INSTANCE_FLAGS (tdep->pc_type) |= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1; - set_gdbarch_read_pc (gdbarch, ft32_read_pc); - set_gdbarch_write_pc (gdbarch, ft32_write_pc); set_gdbarch_unwind_sp (gdbarch, ft32_unwind_sp); set_gdbarch_num_regs (gdbarch, FT32_NUM_REGS); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 0fe6754..fd79f3f 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -650,14 +650,6 @@ m32r_frame_unwind_cache (struct frame_info *this_frame, } static CORE_ADDR -m32r_read_pc (struct regcache *regcache) -{ - ULONGEST pc; - regcache_cooked_read_unsigned (regcache, M32R_PC_REGNUM, &pc); - return pc; -} - -static CORE_ADDR m32r_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame) { return frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM); @@ -912,7 +904,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_wchar_bit (gdbarch, 16); set_gdbarch_wchar_signed (gdbarch, 0); - set_gdbarch_read_pc (gdbarch, m32r_read_pc); set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp); set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS); diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 1d0e8d3..1cda2b3 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1112,15 +1112,6 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr) return builtin_type (gdbarch)->builtin_uint32; } - -static CORE_ADDR -mep_read_pc (struct regcache *regcache) -{ - ULONGEST pc; - regcache_cooked_read_unsigned (regcache, MEP_PC_REGNUM, &pc); - return pc; -} - static enum register_status mep_pseudo_cr32_read (struct gdbarch *gdbarch, readable_regcache *regcache, @@ -2446,7 +2437,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->me_module = me_module; /* Register set. */ - set_gdbarch_read_pc (gdbarch, mep_read_pc); set_gdbarch_num_regs (gdbarch, MEP_NUM_RAW_REGS); set_gdbarch_pc_regnum (gdbarch, MEP_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, MEP_SP_REGNUM); diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 6b1c2ec..0cb9633 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -601,11 +601,6 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type) return (TYPE_LENGTH (type) == 16); } -static void -microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc) -{ - regcache_cooked_write_unsigned (regcache, MICROBLAZE_PC_REGNUM, pc); -} static int dwarf2_to_reg_map[78] = { 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */ @@ -738,8 +733,6 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_frame_args_skip (gdbarch, 8); - set_gdbarch_write_pc (gdbarch, microblaze_write_pc); - set_gdbarch_unwind_pc (gdbarch, microblaze_unwind_pc); microblaze_register_g_packet_guesses (gdbarch); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 93c02d6..e12e01d 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -307,20 +307,6 @@ mn10300_register_type (struct gdbarch *gdbarch, int reg) return builtin_type (gdbarch)->builtin_int; } -static CORE_ADDR -mn10300_read_pc (struct regcache *regcache) -{ - ULONGEST val; - regcache_cooked_read_unsigned (regcache, E_PC_REGNUM, &val); - return val; -} - -static void -mn10300_write_pc (struct regcache *regcache, CORE_ADDR val) -{ - regcache_cooked_write_unsigned (regcache, E_PC_REGNUM, val); -} - /* The breakpoint instruction must be the same size as the smallest instruction in the instruction set. @@ -1423,8 +1409,6 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_num_regs (gdbarch, num_regs); set_gdbarch_register_type (gdbarch, mn10300_register_type); set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue); - set_gdbarch_read_pc (gdbarch, mn10300_read_pc); - set_gdbarch_write_pc (gdbarch, mn10300_write_pc); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum); diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index 5356796..50cacfe 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -448,25 +448,6 @@ moxie_software_single_step (struct regcache *regcache) return next_pcs; } -/* Implement the "read_pc" gdbarch method. */ - -static CORE_ADDR -moxie_read_pc (struct regcache *regcache) -{ - ULONGEST pc; - - regcache_cooked_read_unsigned (regcache, MOXIE_PC_REGNUM, &pc); - return pc; -} - -/* Implement the "write_pc" gdbarch method. */ - -static void -moxie_write_pc (struct regcache *regcache, CORE_ADDR val) -{ - regcache_cooked_write_unsigned (regcache, MOXIE_PC_REGNUM, val); -} - /* Implement the "unwind_sp" gdbarch method. */ static CORE_ADDR @@ -1109,8 +1090,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_wchar_bit (gdbarch, 32); set_gdbarch_wchar_signed (gdbarch, 0); - set_gdbarch_read_pc (gdbarch, moxie_read_pc); - set_gdbarch_write_pc (gdbarch, moxie_write_pc); set_gdbarch_unwind_sp (gdbarch, moxie_unwind_sp); set_gdbarch_num_regs (gdbarch, MOXIE_NUM_REGS);