From patchwork Mon Oct 5 16:44:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 8927 Received: (qmail 129238 invoked by alias); 5 Oct 2015 16:44:38 -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 129133 invoked by uid 89); 5 Oct 2015 16:44:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 05 Oct 2015 16:44:36 +0000 Received: from EUSAAHC003.ericsson.se (Unknown_Domain [147.117.188.81]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 8E.E3.26730.90D32165; Mon, 5 Oct 2015 11:04:09 +0200 (CEST) Received: from elxa4wqvvz1.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.81) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 5 Oct 2015 12:44:31 -0400 From: Antoine Tremblay To: CC: Antoine Tremblay Subject: [PATCH v2 2/7] Add breakpoint_from_kind target_ops for software breakpoints in GDBServer. Date: Mon, 5 Oct 2015 12:44:10 -0400 Message-ID: <1444063455-31558-3-git-send-email-antoine.tremblay@ericsson.com> In-Reply-To: <1444063455-31558-1-git-send-email-antoine.tremblay@ericsson.com> References: <1444063455-31558-1-git-send-email-antoine.tremblay@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes This patch is in preparation for software breakpoints on ARM in GDBServer. This patch introduces a new target_ops and linux_target_ops called breakpoint_from_kind that will be used to ask the target for the right breakpoint for a kind as set in a Z0 packet. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/gdbserver/ChangeLog: * linux-low.c (linux_breakpoint_from_kind): New function. (struct target_ops) : Initialize field. * linux-low.h (struct linux_target_ops) : New field. * target.h (struct target_ops) : New field. --- gdb/gdbserver/linux-low.c | 10 ++++++++++ gdb/gdbserver/linux-low.h | 4 ++++ gdb/gdbserver/target.h | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index dc16fe0..5aa2b1d 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -5965,6 +5965,15 @@ linux_supports_range_stepping (void) return (*the_low_target.supports_range_stepping) (); } +static const unsigned char* +linux_breakpoint_from_kind (int *kind) +{ + if (*the_low_target.breakpoint_from_kind != NULL) + return (*the_low_target.breakpoint_from_kind) (kind); + else + return NULL; +} + /* Enumerate spufs IDs for process PID. */ static int spu_enumerate_spu_ids (long pid, unsigned char *buf, CORE_ADDR offset, int len) @@ -7040,6 +7049,7 @@ static struct target_ops linux_target_ops = { linux_mntns_unlink, linux_mntns_readlink, linux_breakpoint_from_pc, + linux_breakpoint_from_kind }; static void diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index a9964ac..cc19b88 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -227,6 +227,10 @@ struct linux_target_ops /* Returns true if the low target supports range stepping. */ int (*supports_range_stepping) (void); + + /* Returns the proper breakpoint from size, the kind can have target + specific meaning like the z0 kind parameter */ + const unsigned char *(*breakpoint_from_kind) (int *kind); }; extern struct linux_target_ops the_low_target; diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index 603819e..74fb36d 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -446,6 +446,10 @@ struct target_ops can be NULL, the default breakpoint for the target should be returned in this case. */ const unsigned char *(*breakpoint_from_pc) (CORE_ADDR *pcptr, int *lenptr); + + /* Returns a breakpoint from a kind, a kind is a length can have target + specific meaning like the z0 kind parameter. */ + const unsigned char *(*breakpoint_from_kind) (int *kind); }; extern struct target_ops *the_target;