From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32717 invoked by alias); 23 Mar 2016 14:10:33 -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 32648 invoked by uid 89); 23 Mar 2016 14:10:33 -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=456, xfree, Checks, *file 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 (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 23 Mar 2016 14:10:16 +0000 Received: by mail-pf0-f193.google.com with SMTP id x3so4137495pfb.0 for ; Wed, 23 Mar 2016 07:10:16 -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=xOaicpsHPHKsnYixxnJJPnpt5XWHlpPEJiQEKZULEqE=; b=NLYB5gZi8MbJjf+AMmqvvWTIPama8hm4EMUm6grJnQKSQO7VcanVeTK1T7L4gAeECi M/fxRJBfAeru8i/kUnCssdwWoM5sC0j8UUB1fOxXj/nEZ1GIFk9D0UNgFO+oTCC9Q1ky p+BidZinWEDdLYZQ+HfZSboqpVILgMUB0W2QoeQEA2m2GEALY7KWM2Wi5AYILLU/7crc yDtH48su+LDaET34rWjlHDeAzeYpmQn1eXwtmQQK7KfZ7Z0yOYkz/NNuSaLDhIJ+0z3S Puv1kco98cG92xt8xDyaD1cddZqDa6hAoNU0KAc/H0ZIvp5qyDovWztHvplIaz1Q+bh4 8E/A== X-Gm-Message-State: AD7BkJL2zEoZFdtMkr3JN0oIxvaOlN5uRs0PWRNfCSoUgkgB7XgqTgj2+xM0rwBLb1EvJg== X-Received: by 10.98.17.151 with SMTP id 23mr4527459pfr.37.1458742214685; Wed, 23 Mar 2016 07:10:14 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id l11sm4666303pfb.56.2016.03.23.07.10.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 07:10:14 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Remove gdbarch method displaced_step_hw_singlestep Date: Wed, 23 Mar 2016 14:10:00 -0000 Message-Id: <1458742206-622-3-git-send-email-yao.qi@linaro.org> In-Reply-To: <1458742206-622-1-git-send-email-yao.qi@linaro.org> References: <1458742206-622-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00468.txt.bz2 displaced_step_hw_singlestep was added for some targets, which can do hardware single step, but need software single step for some special instructions. After we change gdbarch method software_single_step, displaced_step_hw_singlestep is no longer necessary, because we can get the same information from software_single_step. This patch is to remove displaced_step_hw_singlestep. gdb: 2016-03-22 Yao Qi * aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't call set_gdbarch_displaced_step_hw_singlestep. * aarch64-tdep.c (aarch64_displaced_step_hw_singlestep): Remove. * arch-utils.c (default_displaced_step_hw_singlestep): Remove. * arch-utils.h (default_displaced_step_hw_singlestep): Remove. * gdbarch.sh (displaced_step_hw_singlestep): Remove. * gdbarch.c, gdbarch.h: Regenerated. * infrun.c (resume): Don't call gdbarch_displaced_step_hw_singlestep. Call gdbarch_software_single_step instead. * rs6000-tdep.c (ppc_displaced_step_hw_singlestep): Remove. (rs6000_gdbarch_init): Don't call set_gdbarch_displaced_step_hw_singlestep. * s390-linux-tdep.c (s390_displaced_step_hw_singlestep): Remove. (s390_gdbarch_init): Don't call set_gdbarch_displaced_step_hw_singlestep. --- gdb/aarch64-linux-tdep.c | 2 -- gdb/aarch64-tdep.c | 9 --------- gdb/arch-utils.c | 7 ------- gdb/arch-utils.h | 5 ----- gdb/gdbarch.c | 23 ----------------------- gdb/gdbarch.h | 14 -------------- gdb/gdbarch.sh | 11 ----------- gdb/infrun.c | 21 +++++++++++++++++++-- gdb/rs6000-tdep.c | 12 +----------- gdb/s390-linux-tdep.c | 9 --------- 10 files changed, 20 insertions(+), 93 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 651a0f0..8344d06 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -1208,8 +1208,6 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_displaced_step_free_closure (gdbarch, simple_displaced_step_free_closure); set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location); - set_gdbarch_displaced_step_hw_singlestep (gdbarch, - aarch64_displaced_step_hw_singlestep); } /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 1df6267..17d0894 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2637,15 +2637,6 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch, } } -/* Implement the "displaced_step_hw_singlestep" gdbarch method. */ - -int -aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch, - struct displaced_step_closure *closure) -{ - return 1; -} - /* Initialize the current architecture based on INFO. If possible, re-use an architecture from ARCHES, which is a list of architectures already created during this debugging session. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index c3d7802..3049252 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -67,13 +67,6 @@ simple_displaced_step_free_closure (struct gdbarch *gdbarch, xfree (closure); } -int -default_displaced_step_hw_singlestep (struct gdbarch *gdbarch, - struct displaced_step_closure *closure) -{ - return !gdbarch_software_single_step_p (gdbarch); -} - CORE_ADDR displaced_step_at_entry_point (struct gdbarch *gdbarch) { diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 9e1e70e..318e227 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -45,11 +45,6 @@ extern void simple_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure); -/* Default implementation of gdbarch_displaced_hw_singlestep. */ -extern int - default_displaced_step_hw_singlestep (struct gdbarch *, - struct displaced_step_closure *); - /* Possible value for gdbarch_displaced_step_location: Place displaced instructions at the program's entry point, leaving space for inferior function call return breakpoints. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 04e5a48..123df30 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -278,7 +278,6 @@ struct gdbarch gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint; ULONGEST max_insn_length; gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn; - gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep; gdbarch_displaced_step_fixup_ftype *displaced_step_fixup; gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure; gdbarch_displaced_step_location_ftype *displaced_step_location; @@ -416,7 +415,6 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->adjust_dwarf2_line = default_adjust_dwarf2_line; gdbarch->register_reggroup_p = default_register_reggroup_p; gdbarch->skip_permanent_breakpoint = default_skip_permanent_breakpoint; - gdbarch->displaced_step_hw_singlestep = default_displaced_step_hw_singlestep; gdbarch->displaced_step_fixup = NULL; gdbarch->displaced_step_free_closure = NULL; gdbarch->displaced_step_location = NULL; @@ -627,7 +625,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of skip_permanent_breakpoint, invalid_p == 0 */ /* Skip verify of max_insn_length, has predicate. */ /* Skip verify of displaced_step_copy_insn, has predicate. */ - /* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */ /* Skip verify of displaced_step_fixup, has predicate. */ if ((! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn)) fprintf_unfiltered (log, "\n\tdisplaced_step_free_closure"); @@ -876,9 +873,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: displaced_step_free_closure = <%s>\n", host_address_to_string (gdbarch->displaced_step_free_closure)); fprintf_unfiltered (file, - "gdbarch_dump: displaced_step_hw_singlestep = <%s>\n", - host_address_to_string (gdbarch->displaced_step_hw_singlestep)); - fprintf_unfiltered (file, "gdbarch_dump: displaced_step_location = <%s>\n", host_address_to_string (gdbarch->displaced_step_location)); fprintf_unfiltered (file, @@ -3772,23 +3766,6 @@ set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, } int -gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure) -{ - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->displaced_step_hw_singlestep != NULL); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_hw_singlestep called\n"); - return gdbarch->displaced_step_hw_singlestep (gdbarch, closure); -} - -void -set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, - gdbarch_displaced_step_hw_singlestep_ftype displaced_step_hw_singlestep) -{ - gdbarch->displaced_step_hw_singlestep = displaced_step_hw_singlestep; -} - -int gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 18da3ce..f11e837 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -956,20 +956,6 @@ typedef struct displaced_step_closure * (gdbarch_displaced_step_copy_insn_ftype) extern struct displaced_step_closure * gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs); extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn); -/* Return true if GDB should use hardware single-stepping to execute - the displaced instruction identified by CLOSURE. If false, - GDB will simply restart execution at the displaced instruction - location, and it is up to the target to ensure GDB will receive - control again (e.g. by placing a software breakpoint instruction - into the displaced instruction buffer). - - The default implementation returns false on all targets that - provide a gdbarch_software_single_step routine, and true otherwise. */ - -typedef int (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure); -extern int gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure); -extern void set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep); - /* Fix up the state resulting from successfully single-stepping a displaced instruction, to give the result we would have gotten from stepping the instruction in its original location. diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 667c3f1..aae3acb 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -777,17 +777,6 @@ V:ULONGEST:max_insn_length:::0:0 # that case. M:struct displaced_step_closure *:displaced_step_copy_insn:CORE_ADDR from, CORE_ADDR to, struct regcache *regs:from, to, regs -# Return true if GDB should use hardware single-stepping to execute -# the displaced instruction identified by CLOSURE. If false, -# GDB will simply restart execution at the displaced instruction -# location, and it is up to the target to ensure GDB will receive -# control again (e.g. by placing a software breakpoint instruction -# into the displaced instruction buffer). -# -# The default implementation returns false on all targets that -# provide a gdbarch_software_single_step routine, and true otherwise. -m:int:displaced_step_hw_singlestep:struct displaced_step_closure *closure:closure::default_displaced_step_hw_singlestep::0 - # Fix up the state resulting from successfully single-stepping a # displaced instruction, to give the result we would have gotten from # stepping the instruction in its original location. diff --git a/gdb/infrun.c b/gdb/infrun.c index 5dbcf7a..10aa3f1 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -2611,8 +2611,25 @@ resume (enum gdb_signal sig) pc = regcache_read_pc (get_thread_regcache (inferior_ptid)); displaced = get_displaced_stepping_state (ptid_get_pid (inferior_ptid)); - step = gdbarch_displaced_step_hw_singlestep (gdbarch, - displaced->step_closure); + + if (gdbarch_software_single_step_p (gdbarch)) + { + VEC (CORE_ADDR) * next_pcs = NULL; + + next_pcs = gdbarch_software_single_step (gdbarch, + get_current_frame ()); + + if (next_pcs != 0) + { + step = 0; + VEC_free (CORE_ADDR, next_pcs); + } + else + step = 1; + } + else + step = 1; + } } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 26c8ed9..5f0ede2 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1136,15 +1136,6 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch, from + offset); } -/* Always use hardware single-stepping to execute the - displaced instruction. */ -static int -ppc_displaced_step_hw_singlestep (struct gdbarch *gdbarch, - struct displaced_step_closure *closure) -{ - return 1; -} - /* Checks for an atomic sequence of instructions beginning with a LWARX/LDARX instruction and ending with a STWCX/STDCX instruction. If such a sequence is found, attempt to step through it. A breakpoint is placed at the end of @@ -6071,8 +6062,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Setup displaced stepping. */ set_gdbarch_displaced_step_copy_insn (gdbarch, ppc_displaced_step_copy_insn); - set_gdbarch_displaced_step_hw_singlestep (gdbarch, - ppc_displaced_step_hw_singlestep); + set_gdbarch_displaced_step_fixup (gdbarch, ppc_displaced_step_fixup); set_gdbarch_displaced_step_free_closure (gdbarch, simple_displaced_step_free_closure); diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index dd26ba6..77c7b33 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -759,14 +759,6 @@ s390_software_single_step (struct frame_info *frame) return next_pcs; } -static int -s390_displaced_step_hw_singlestep (struct gdbarch *gdbarch, - struct displaced_step_closure *closure) -{ - return 1; -} - - /* Maps for register sets. */ static const struct regcache_map_entry s390_gregmap[] = @@ -7990,7 +7982,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc); set_gdbarch_software_single_step (gdbarch, s390_software_single_step); - set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep); set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue); set_gdbarch_stack_frame_destroyed_p (gdbarch, s390_stack_frame_destroyed_p); -- 1.9.1