This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/darwin]: do not cache single step flag


Hi,

as an attempt to reduce context switches, the single step
flag was cached and applied only to the target in case of
change.  But this wasnât reliable in case of inferior call,
as the context was saved and restored.

This patch simply remove this shortcut.  Also remove a couple
of unneeded casts.

Pushed on master.

Tristan.

darwin-nat: disable sstep cache.

Was not reliable after inferior call.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6a8592e..605eb39 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2015-11-23  Tristan Gingold  <gingold@adacore.com>
 
+	* darwin-nat.c (darwin_ptrace): Avoid a cast.
+	(darwin_resume_thread): Ditto.  And always set or reset
+	single step.
+
+2015-11-23  Tristan Gingold  <gingold@adacore.com>
+
 	* darwin-nat.c (darwin_read_dyld_info): Write address in
 	big-endian order.
 	* solib-darwin.c (darwin_validate_exec_header): New function,
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index cb2b08e..457ba89 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -245,12 +245,12 @@ unparse_exception_type (unsigned int i)
 
 static int
 darwin_ptrace (const char *name,
-	       int request, int pid, PTRACE_TYPE_ARG3 arg3, int arg4)
+	       int request, int pid, caddr_t arg3, int arg4)
 {
   int ret;
 
   errno = 0;
-  ret = ptrace (request, pid, (caddr_t) arg3, arg4);
+  ret = ptrace (request, pid, arg3, arg4);
   if (ret == -1 && errno == 0)
     ret = 0;
 
@@ -728,7 +728,7 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread,
 	{
 	  /* Either deliver a new signal or cancel the signal received.  */
 	  res = PTRACE (PT_THUPDATE, inf->pid,
-			(void *)(uintptr_t)thread->gdb_port, nsignal);
+			(caddr_t)thread->gdb_port, nsignal);
 	  if (res < 0)
 	    inferior_debug (1, _("ptrace THUP: res=%d\n"), res);
 	}
@@ -743,13 +743,10 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread,
 	}
 
       /* Set or reset single step.  */
-      if (step != thread->single_step)
-	{
-	  inferior_debug (4, _("darwin_set_sstep (thread=0x%x, enable=%d)\n"),
-			  thread->gdb_port, step);
-	  darwin_set_sstep (thread->gdb_port, step);
-	  thread->single_step = step;
-	}
+      inferior_debug (4, _("darwin_set_sstep (thread=0x%x, enable=%d)\n"),
+		      thread->gdb_port, step);
+      darwin_set_sstep (thread->gdb_port, step);
+      thread->single_step = step;
 
       darwin_send_reply (inf, thread);
       thread->msg_state = DARWIN_RUNNING;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]