From patchwork Thu Jul 30 23:19:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 7946 Received: (qmail 15753 invoked by alias); 30 Jul 2015 23:19:52 -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 15705 invoked by uid 89); 30 Jul 2015 23:19:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Jul 2015 23:19:49 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1ZKx74-0004xl-AS from Don_Breazeal@mentor.com ; Thu, 30 Jul 2015 16:19:46 -0700 Received: from build4-lucid-cs (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Thu, 30 Jul 2015 16:19:45 -0700 Received: by build4-lucid-cs (Postfix, from userid 1905) id 9B8F041034; Thu, 30 Jul 2015 16:19:46 -0700 (PDT) From: Don Breazeal To: , Subject: [PATCH v2 2/5] Extended-remote exec catchpoints Date: Thu, 30 Jul 2015 16:19:17 -0700 Message-ID: <1438298360-29594-3-git-send-email-donb@codesourcery.com> In-Reply-To: <1438298360-29594-1-git-send-email-donb@codesourcery.com> References: <1436996979-32350-1-git-send-email-donb@codesourcery.com> <1438298360-29594-1-git-send-email-donb@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes This patch is unchanged from v1 of this patchset. ----- This patch implements exec catchpoints for extended-remote Linux targets. The implementation follows the same approach used for fork catchpoints, implementing extended-remote target routines for inserting and removing the catchpoints by just checking if exec events are supported. Existing host-side code and previous support for extended-remote exec events takes care of the rest. Tested on x86_64 GNU/Linux with native, native-gdbserver, and native-extended-gdbserver targets. Thanks --Don gdb/ 2015-07-30 Don Breazeal * remote.c (remote_exec_event_p): New function. (remote_insert_exec_catchpoint): New function. (remote_remove_exec_catchpoint): New function. (init_extended_remote_ops): Initialize extended_remote_ops members to_insert_exec_catchpoint and to_remove_exec_catchpoint. --- gdb/remote.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gdb/remote.c b/gdb/remote.c index 1aeba30..bfde892 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1500,6 +1500,14 @@ remote_vfork_event_p (struct remote_state *rs) return packet_support (PACKET_vfork_event_feature) == PACKET_ENABLE; } +/* Returns true if exec events are supported. */ + +static int +remote_exec_event_p (struct remote_state *rs) +{ + return packet_support (PACKET_exec_event_feature) == PACKET_ENABLE; +} + /* Insert fork catchpoint target routine. If fork events are enabled then return success, nothing more to do. */ @@ -1540,6 +1548,26 @@ remote_remove_vfork_catchpoint (struct target_ops *ops, int pid) return 0; } +/* Insert exec catchpoint target routine. If exec events are + enabled, just return success. */ + +static int +remote_insert_exec_catchpoint (struct target_ops *ops, int pid) +{ + struct remote_state *rs = get_remote_state (); + + return !remote_exec_event_p (rs); +} + +/* Remove exec catchpoint target routine. Nothing to do, just + return success. */ + +static int +remote_remove_exec_catchpoint (struct target_ops *ops, int pid) +{ + return 0; +} + /* Tokens for use by the asynchronous signal handlers for SIGINT. */ static struct async_signal_handler *async_sigint_remote_twice_token; static struct async_signal_handler *async_sigint_remote_token; @@ -12417,6 +12445,10 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; = remote_insert_vfork_catchpoint; extended_remote_ops.to_remove_vfork_catchpoint = remote_remove_vfork_catchpoint; + extended_remote_ops.to_insert_exec_catchpoint + = remote_insert_exec_catchpoint; + extended_remote_ops.to_remove_exec_catchpoint + = remote_remove_exec_catchpoint; } static int