From patchwork Fri Oct 31 23:28:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Breazeal X-Patchwork-Id: 3528 Received: (qmail 32296 invoked by alias); 31 Oct 2014 23:30:53 -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 32287 invoked by uid 89); 31 Oct 2014 23:30:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE 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; Fri, 31 Oct 2014 23:30:52 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1XkLeb-0002G4-CR from Don_Breazeal@mentor.com for gdb-patches@sourceware.org; Fri, 31 Oct 2014 16:30:49 -0700 Received: from build4-lucid-cs (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.181.6; Fri, 31 Oct 2014 16:30:49 -0700 Received: by build4-lucid-cs (Postfix, from userid 1905) id 1B82E40DDD; Fri, 31 Oct 2014 16:30:48 -0700 (PDT) From: Don Breazeal To: Subject: [PATCH 13/16 v3] Extended-remote exec catchpoints Date: Fri, 31 Oct 2014 16:28:51 -0700 Message-ID: <1414798134-11536-11-git-send-email-donb@codesourcery.com> In-Reply-To: <1408580964-27916-1-git-send-email-donb@codesourcery.com> References: <1408580964-27916-1-git-send-email-donb@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes This patch implements exec catchpoints for extended-remote Linux targets. The implementation follows the same appraoch used in patch 9 of this series for fork catchpoints, implementing extended_remote target routines for insert/remove. Existing host-side code and the support for exec events introduced in patch 12 of this series takes care of the rest. Tested native, remote, extended-remote on x64 Ubuntu. Thanks --Don gdb/ 2014-10-31 Don Breazeal * remote.c (extended_remote_insert_exec_catchpoint): New function. (extended_remote_remove_exec_catchpoint): New function. (_initialize_remote): Initialize target vector with new exec catchpoint functions. --- gdb/remote.c | 28 ++++++++++++++++++++++++---- 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 7409860..1973433 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1461,9 +1461,6 @@ extended_remote_vfork_event_p (struct remote_state *rs) return packet_support (PACKET_vfork_event_feature) == PACKET_ENABLE; } -/* Ifdef out the function below until it is needed for - exec catchpoints. */ -#if 0 /* Returns true if exec events are supported. */ static int @@ -1471,7 +1468,6 @@ extended_remote_exec_event_p (struct remote_state *rs) { return packet_support (PACKET_exec_event_feature) == PACKET_ENABLE; } -#endif /* Target follow-fork function for extended-remote targets. */ @@ -1540,6 +1536,26 @@ extended_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 +extended_remote_insert_exec_catchpoint (struct target_ops *ops, int pid) +{ + struct remote_state *rs = get_remote_state (); + + return !extended_remote_exec_event_p (rs); +} + +/* Remove exec catchpoint target routine. Nothing to do, just + return success. */ + +static int +extended_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; @@ -11777,6 +11793,10 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; extended_remote_ops.to_remove_vfork_catchpoint = extended_remote_remove_vfork_catchpoint; extended_remote_ops.to_follow_fork = extended_remote_follow_fork; + extended_remote_ops.to_insert_exec_catchpoint + = extended_remote_insert_exec_catchpoint; + extended_remote_ops.to_remove_exec_catchpoint + = extended_remote_remove_exec_catchpoint; extended_remote_ops.to_mourn_inferior = extended_remote_mourn; extended_remote_ops.to_detach = extended_remote_detach; extended_remote_ops.to_attach = extended_remote_attach;