From patchwork Wed Jan 6 14:42:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 10252 Received: (qmail 55530 invoked by alias); 6 Jan 2016 14:42:21 -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 55516 invoked by uid 89); 6 Jan 2016 14:42:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=594, 25810, 258, 10 X-HELO: mail-pa0-f48.google.com Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 06 Jan 2016 14:42:20 +0000 Received: by mail-pa0-f48.google.com with SMTP id cy9so234678109pac.0 for ; Wed, 06 Jan 2016 06:42:19 -0800 (PST) X-Received: by 10.66.122.97 with SMTP id lr1mr3775368pab.68.1452091338389; Wed, 06 Jan 2016 06:42:18 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id x10sm44966861pas.37.2016.01.06.06.42.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 06 Jan 2016 06:42:17 -0800 (PST) From: Yao Qi To: Antoine Tremblay Cc: Subject: Re: [PATCH v8 5/7] Support software single step on ARM in GDBServer References: <1450361684-29536-1-git-send-email-antoine.tremblay@ericsson.com> <1450361684-29536-6-git-send-email-antoine.tremblay@ericsson.com> Date: Wed, 06 Jan 2016 14:42:13 +0000 In-Reply-To: <1450361684-29536-6-git-send-email-antoine.tremblay@ericsson.com> (Antoine Tremblay's message of "Thu, 17 Dec 2015 09:14:42 -0500") Message-ID: <8660z6ydkq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes Antoine Tremblay writes: Hi Antoine, > +/* Find the next possible PCs for thumb mode. */ > +VEC (CORE_ADDR) *thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, > + CORE_ADDR pc); > + > +/* Find the next possible PCs for arm mode. */ > +VEC (CORE_ADDR) *arm_get_next_pcs_raw (struct arm_get_next_pcs *self, > + CORE_ADDR pc); > + > +#endif /* ARM_GET_NEXT_PCS_H */ Is there any reason to make them extern? I have a patch below to make them static. What do you think? diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c index 4db74e7..aba45e3 100644 --- a/gdb/arch/arm-get-next-pcs.c +++ b/gdb/arch/arm-get-next-pcs.c @@ -258,34 +258,10 @@ arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self, return next_pcs; } -/* See arm-get-next-pcs.h. */ - -VEC (CORE_ADDR) * -arm_get_next_pcs (struct arm_get_next_pcs *self, CORE_ADDR pc) -{ - VEC (CORE_ADDR) *next_pcs = NULL; - - if (self->ops->is_thumb (self)) - { - next_pcs = thumb_deal_with_atomic_sequence_raw (self, pc); - if (next_pcs == NULL) - next_pcs = thumb_get_next_pcs_raw (self, pc); - } - else - { - next_pcs = arm_deal_with_atomic_sequence_raw (self, pc); - if (next_pcs == NULL) - next_pcs = arm_get_next_pcs_raw (self, pc); - } +/* Find the next possible PCs for thumb mode. */ - return next_pcs; -} - -/* See arm-get-next-pcs.h. */ - -VEC (CORE_ADDR) * -thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, - CORE_ADDR pc) +static VEC (CORE_ADDR) * +thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc) { int byte_order = self->byte_order; int byte_order_for_code = self->byte_order_for_code; @@ -664,9 +640,8 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, in Thumb-State, and gdbarch_addr_bits_remove () to get the plain memory address in GDB and arm_addr_bits_remove in GDBServer. */ -VEC (CORE_ADDR) * -arm_get_next_pcs_raw (struct arm_get_next_pcs *self, - CORE_ADDR pc) +static VEC (CORE_ADDR) * +arm_get_next_pcs_raw (struct arm_get_next_pcs *self, CORE_ADDR pc) { int byte_order = self->byte_order; unsigned long pc_val; @@ -924,3 +899,26 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self, VEC_safe_push (CORE_ADDR, next_pcs, nextpc); return next_pcs; } + +/* See arm-get-next-pcs.h. */ + +VEC (CORE_ADDR) * +arm_get_next_pcs (struct arm_get_next_pcs *self, CORE_ADDR pc) +{ + VEC (CORE_ADDR) *next_pcs = NULL; + + if (self->ops->is_thumb (self)) + { + next_pcs = thumb_deal_with_atomic_sequence_raw (self, pc); + if (next_pcs == NULL) + next_pcs = thumb_get_next_pcs_raw (self, pc); + } + else + { + next_pcs = arm_deal_with_atomic_sequence_raw (self, pc); + if (next_pcs == NULL) + next_pcs = arm_get_next_pcs_raw (self, pc); + } + + return next_pcs; +} diff --git a/gdb/arch/arm-get-next-pcs.h b/gdb/arch/arm-get-next-pcs.h index fdbc9bc..895e866 100644 --- a/gdb/arch/arm-get-next-pcs.h +++ b/gdb/arch/arm-get-next-pcs.h @@ -59,12 +59,4 @@ void arm_get_next_pcs_ctor (struct arm_get_next_pcs *self, VEC (CORE_ADDR) *arm_get_next_pcs (struct arm_get_next_pcs *self, CORE_ADDR pc); -/* Find the next possible PCs for thumb mode. */ -VEC (CORE_ADDR) *thumb_get_next_pcs_raw (struct arm_get_next_pcs *self, - CORE_ADDR pc); - -/* Find the next possible PCs for arm mode. */ -VEC (CORE_ADDR) *arm_get_next_pcs_raw (struct arm_get_next_pcs *self, - CORE_ADDR pc); - #endif /* ARM_GET_NEXT_PCS_H */