[2/5] Extended-remote exec catchpoints

Message ID 1436996979-32350-3-git-send-email-donb@codesourcery.com
State New, archived
Headers

Commit Message

Don Breazeal July 15, 2015, 9:49 p.m. UTC
  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

2015-07-15  Don Breazeal  <donb@codesourcery.com>

	* gdb/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(+)
  

Comments

Pedro Alves Aug. 13, 2015, 3 p.m. UTC | #1
On 07/15/2015 10:49 PM, Don Breazeal wrote:

> 2015-07-15  Don Breazeal  <donb@codesourcery.com>
> 
> 	* gdb/remote.c (remote_exec_event_p): New function.

No "gdb/".

> 	(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.

Otherwise seems fine.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/remote.c b/gdb/remote.c
index c0b3423..153b183 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1499,6 +1499,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.  */
 
@@ -1539,6 +1547,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;
@@ -12388,6 +12416,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