From patchwork Sat Jun 27 16:21:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei-cheng, Wang" X-Patchwork-Id: 7411 Received: (qmail 44803 invoked by alias); 27 Jun 2015 16:21:58 -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 44775 invoked by uid 89); 27 Jun 2015 16:21:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f180.google.com Received: from mail-pd0-f180.google.com (HELO mail-pd0-f180.google.com) (209.85.192.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 27 Jun 2015 16:21:56 +0000 Received: by pdjn11 with SMTP id n11so91988647pdj.0 for ; Sat, 27 Jun 2015 09:21:54 -0700 (PDT) X-Received: by 10.70.101.39 with SMTP id fd7mr14968626pdb.9.1435422114547; Sat, 27 Jun 2015 09:21:54 -0700 (PDT) Received: from localhost.localdomain (114-32-204-230.HINET-IP.hinet.net. [114.32.204.230]) by mx.google.com with ESMTPSA id ju3sm27788766pbc.33.2015.06.27.09.21.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 27 Jun 2015 09:21:54 -0700 (PDT) From: Wei-cheng Wang To: uweigand@de.ibm.com, gdb-patches@sourceware.org Cc: Wei-cheng Wang Subject: [PATCH 2/5 v4] powerpc: Support z-point type in gdbserver. Date: Sun, 28 Jun 2015 00:21:39 +0800 Message-Id: <1435422102-39438-2-git-send-email-cole945@gmail.com> In-Reply-To: <1435422102-39438-1-git-send-email-cole945@gmail.com> References: <1435422102-39438-1-git-send-email-cole945@gmail.com> Hi, Ulrich Weigand wrote: > Well, if we add a function that returns true on supports_z_point_type > for Z_PACKET_SW_BP, then we also need to provide functions that > actually do insert/remove such breakpoints. (I know that you have > that in the next patch, but each patch in a series should be > functionally correct on its own, so they really should be here.) Merge ppc_insert_point and ppc_insert_point to this patch. Thanks, Wei-cheng --- Support z-point, so tracepoints and breakpoints can be inserted at the same location. gdb/gdbserver/ChangeLog 2015-06-27 Wei-cheng Wang * linux-ppc-low.c (ppc_supports_z_point_type): New function: (ppc_insert_point, ppc_remove_point): Insert/remove z-packet breakpoints. (ppc64_emit_ops_vector): Add target ops - ppc_supports_z_point_type, ppc_insert_point, ppc_remove_point. --- gdb/gdbserver/linux-ppc-low.c | 69 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 188fac0..41ec281 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -512,6 +512,69 @@ ppc_breakpoint_at (CORE_ADDR where) return 0; } +/* Implement supports_z_point_type target-ops. + Returns true if type Z_TYPE breakpoint is supported. + + Handling software breakpoint at server side, so tracepoints + and breakpoints can be inserted at the same location. */ + +static int +ppc_supports_z_point_type (char z_type) +{ + switch (z_type) + { + case Z_PACKET_SW_BP: + return 1; + case Z_PACKET_HW_BP: + case Z_PACKET_WRITE_WP: + case Z_PACKET_ACCESS_WP: + default: + return 0; + } +} + +/* Implement insert_point target-ops. + Returns 0 on success, -1 on failure and 1 on unsupported. */ + +static int +ppc_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, + int size, struct raw_breakpoint *bp) +{ + switch (type) + { + case raw_bkpt_type_sw: + return insert_memory_breakpoint (bp); + + case raw_bkpt_type_hw: + case raw_bkpt_type_write_wp: + case raw_bkpt_type_access_wp: + default: + /* Unsupported. */ + return 1; + } +} + +/* Implement remove_point target-ops. + Returns 0 on success, -1 on failure and 1 on unsupported. */ + +static int +ppc_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, + int size, struct raw_breakpoint *bp) +{ + switch (type) + { + case raw_bkpt_type_sw: + return remove_memory_breakpoint (bp); + + case raw_bkpt_type_hw: + case raw_bkpt_type_write_wp: + case raw_bkpt_type_access_wp: + default: + /* Unsupported. */ + return 1; + } +} + /* Provide only a fill function for the general register set. ps_lgetregs will use this for NPTL support. */ @@ -690,9 +753,9 @@ struct linux_target_ops the_low_target = { NULL, 0, ppc_breakpoint_at, - NULL, /* supports_z_point_type */ - NULL, - NULL, + ppc_supports_z_point_type, + ppc_insert_point, + ppc_remove_point, NULL, NULL, ppc_collect_ptrace_register,