diff mbox

[13/16,v3] Extended-remote exec catchpoints

Message ID 1414798134-11536-11-git-send-email-donb@codesourcery.com
State New
Headers show

Commit Message

Don Breazeal Oct. 31, 2014, 11:28 p.m. UTC
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  <donb@codesourcery.com>

	* 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 mbox

Patch

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;