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]

Re: [PATCH v2 1/2] consolidate gdbserver global data


The previous patch was split into two parts to hopefully make it a bit easier to digest. This first patch simply changes a few variable names that conflict with the names of gdbserver external data variables. Those conflicts are:
 - struct thread_info member last_status
   renamed to last_waitstatus
 - various local variables mem_buf
   renamed to mem_buffer
 - a parameter in nat/linux-personality.h disable_randomization
   renamed to disable_randomization
 - the external data variable own_buf
   renamed to own_buffer
   to avoid conflicts with a frequently used local variable own_buf
The next patch consolidates global data into structures. To maintain source compatibility, macros are defined such that, e.g. out_buf will logically expand to client_state->out_buf. The above name changes will avoid name conflicts.

gdb/gdbserver/Changelog

* server.c (handle_qxfer_btrace, resume): Global own_buf now own_buffer
    thread_info last_status now last_waitstatus.  (Change all references)

    * remote-utils.c Local mem_buf name mem_buffer.  (Change all)

    * linux-low.c:  Global last_status now last_waitstatus.  (Change all)

    * gdbthread.h (last_status):  Now known as last_waitstatus.



diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h
index 0510419..7bada2f 100644
--- a/gdb/gdbserver/gdbthread.h
+++ b/gdb/gdbserver/gdbthread.h
@@ -37,7 +37,7 @@ struct thread_info
   enum resume_kind last_resume_kind;

   /* The last wait status reported for this thread.  */
-  struct target_waitstatus last_status;
+  struct target_waitstatus last_waitstatus;

   /* True if LAST_STATUS hasn't been reported to GDB yet.  */
   int status_pending_p;
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 95f3ad0..4d64250 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -109,7 +109,7 @@ add_thread (ptid_t thread_id, void *target_data)

   new_thread->entry.id = thread_id;
   new_thread->last_resume_kind = resume_continue;
-  new_thread->last_status.kind = TARGET_WAITKIND_IGNORE;
+  new_thread->last_waitstatus.kind = TARGET_WAITKIND_IGNORE;

   add_inferior_to_list (&all_threads, &new_thread->entry);

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 5e2dc58..1f0a977 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -520,7 +520,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 	  child_lwp->status_pending_p = 0;
 	  child_thr = get_lwp_thread (child_lwp);
 	  child_thr->last_resume_kind = resume_stop;
-	  child_thr->last_status.kind = TARGET_WAITKIND_STOPPED;
+	  child_thr->last_waitstatus.kind = TARGET_WAITKIND_STOPPED;

 	  /* If we're suspending all threads, leave this one suspended
 	     too.  */
@@ -646,7 +646,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
       event_lwp->status_pending_p = 1;
       event_lwp->status_pending = wstat;
       event_thr->last_resume_kind = resume_continue;
-      event_thr->last_status.kind = TARGET_WAITKIND_IGNORE;
+      event_thr->last_waitstatus.kind = TARGET_WAITKIND_IGNORE;

       /* Report the event.  */
       *orig_event_lwp = event_lwp;
@@ -1342,13 +1342,13 @@ get_detach_signal (struct thread_info *thread)
       /* If the thread had been suspended by gdbserver, and it stopped
 	 cleanly, then it'll have stopped with SIGSTOP.  But we don't
 	 want to deliver that SIGSTOP.  */
-      if (thread->last_status.kind != TARGET_WAITKIND_STOPPED
-	  || thread->last_status.value.sig == GDB_SIGNAL_0)
+      if (thread->last_waitstatus.kind != TARGET_WAITKIND_STOPPED
+	  || thread->last_waitstatus.value.sig == GDB_SIGNAL_0)
 	return 0;

       /* Otherwise, we may need to deliver the signal we
 	 intercepted.  */
-      status = lp->last_status;
+      status = lp->last_waitstatus;
     }

   if (!WIFSTOPPED (status))
@@ -1564,7 +1564,7 @@ thread_still_has_status_pending_p (struct thread_info *thread)
       CORE_ADDR pc;
       int discard = 0;

-      gdb_assert (lp->last_status != 0);
+      gdb_assert (lp->last_waitstatus != 0);

       pc = get_pc (lp);

@@ -1626,7 +1626,7 @@ lwp_resumed (struct lwp_info *lwp)
      corresponding stop to gdb yet?  If so, the thread is still
      resumed/running from gdb's perspective.  */
   if (thread->last_resume_kind == resume_stop
-      && thread->last_status.kind == TARGET_WAITKIND_IGNORE)
+      && thread->last_waitstatus.kind == TARGET_WAITKIND_IGNORE)
     return 1;

   return 0;
@@ -2305,7 +2305,7 @@ linux_low_filter_event (int lwpid, int wstat)

   child->stopped = 1;

-  child->last_status = wstat;
+  child->last_waitstatus = wstat;

   /* Check if the thread has exited.  */
   if ((WIFEXITED (wstat) || WIFSIGNALED (wstat)))
@@ -2462,7 +2462,7 @@ resume_stopped_resumed_lwps (struct inferior_list_entry *entry)
   if (lp->stopped
       && !lp->suspended
       && !lp->status_pending_p
-      && thread->last_status.kind == TARGET_WAITKIND_IGNORE)
+      && thread->last_waitstatus.kind == TARGET_WAITKIND_IGNORE)
     {
       int step = thread->last_resume_kind == resume_step;

@@ -2699,7 +2699,7 @@ count_events_callback (struct inferior_list_entry *entry, void *data)
   gdb_assert (count != NULL);

   /* Count only resumed LWPs that have an event pending. */
-  if (thread->last_status.kind == TARGET_WAITKIND_IGNORE
+  if (thread->last_waitstatus.kind == TARGET_WAITKIND_IGNORE
       && lp->status_pending_p)
     (*count)++;

@@ -2714,7 +2714,7 @@ select_singlestep_lwp_callback (struct inferior_list_entry *entry, void *data)
   struct thread_info *thread = (struct thread_info *) entry;
   struct lwp_info *lp = get_thread_lwp (thread);

-  if (thread->last_status.kind == TARGET_WAITKIND_IGNORE
+  if (thread->last_waitstatus.kind == TARGET_WAITKIND_IGNORE
       && thread->last_resume_kind == resume_step
       && lp->status_pending_p)
     return 1;
@@ -2734,7 +2734,7 @@ select_event_lwp_callback (struct inferior_list_entry *entry, void *data)
   gdb_assert (selector != NULL);

   /* Select only resumed LWPs that have an event pending. */
-  if (thread->last_status.kind == TARGET_WAITKIND_IGNORE
+  if (thread->last_waitstatus.kind == TARGET_WAITKIND_IGNORE
       && lp->status_pending_p)
     if ((*selector)-- == 0)
       return 1;
@@ -4287,7 +4287,7 @@ linux_set_resume_request (struct inferior_list_entry *entry, void *arg)
 	    {
 	      if (debug_threads)
 		debug_printf ("already %s LWP %ld at GDB's request\n",
-			      (thread->last_status.kind
+			      (thread->last_waitstatus.kind
 			       == TARGET_WAITKIND_STOPPED)
 			      ? "stopped"
 			      : "stopping",
@@ -4697,7 +4697,7 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg)

       /* For stop requests, we're done.  */
       lwp->resume = NULL;
-      thread->last_status.kind = TARGET_WAITKIND_IGNORE;
+      thread->last_waitstatus.kind = TARGET_WAITKIND_IGNORE;
       return 0;
     }

@@ -4738,8 +4738,8 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg)
 	     make sure to queue its siginfo.  We can ignore the return
 	     value of ptrace; if it fails, we'll skip
 	     PTRACE_SETSIGINFO.  */
-	  if (WIFSTOPPED (lwp->last_status)
-	      && WSTOPSIG (lwp->last_status) == lwp->resume->sig)
+	  if (WIFSTOPPED (lwp->last_waitstatus)
+	      && WSTOPSIG (lwp->last_waitstatus) == lwp->resume->sig)
 	    ptrace (PTRACE_GETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
 		    &p_sig->info);

@@ -4747,7 +4747,7 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg)
 	}
     }

-  thread->last_status.kind = TARGET_WAITKIND_IGNORE;
+  thread->last_waitstatus.kind = TARGET_WAITKIND_IGNORE;
   lwp->resume = NULL;
   return 0;
 }
@@ -4851,7 +4851,7 @@ proceed_one_lwp (struct inferior_list_entry *entry, void *except)
     }

   if (thread->last_resume_kind == resume_stop
-      && thread->last_status.kind != TARGET_WAITKIND_IGNORE)
+      && thread->last_waitstatus.kind != TARGET_WAITKIND_IGNORE)
     {
       if (debug_threads)
 	debug_printf ("   client wants LWP to remain %ld stopped\n",
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index c211a37..dbfb7f2 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -278,7 +278,7 @@ struct lwp_info
   int stopped;

   /* When stopped is set, the last wait status recorded for this lwp.  */
-  int last_status;
+  int last_waitstatus;

   /* If WAITSTATUS->KIND != TARGET_WAITKIND_IGNORE, the waitstatus for
      this LWP's last event, to pass to GDB without any further
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 05e3d63..a00a9f5 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1493,16 +1493,16 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
   while (own_buf[0] == 'm')
     {
       CORE_ADDR mem_addr;
-      unsigned char *mem_buf;
+      unsigned char *mem_buffer;
       unsigned int mem_len;

       decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
-      mem_buf = (unsigned char *) xmalloc (mem_len);
-      if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
-	bin2hex (mem_buf, own_buf, mem_len);
+      mem_buffer = (unsigned char *) xmalloc (mem_len);
+      if (read_inferior_memory (mem_addr, mem_buffer, mem_len) == 0)
+	bin2hex (mem_buffer, own_buf, mem_len);
       else
 	write_enn (own_buf);
-      free (mem_buf);
+      free (mem_buffer);
       if (putpkt (own_buf) < 0)
 	return -1;
       len = getpkt (own_buf);
@@ -1575,36 +1575,36 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
   while (own_buf[0] == 'm' || own_buf[0] == 'M' || own_buf[0] == 'X')
     {
       CORE_ADDR mem_addr;
-      unsigned char *mem_buf = NULL;
+      unsigned char *mem_buffer = NULL;
       unsigned int mem_len;

       if (own_buf[0] == 'm')
 	{
 	  decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
-	  mem_buf = (unsigned char *) xmalloc (mem_len);
-	  if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
-	    bin2hex (mem_buf, own_buf, mem_len);
+	  mem_buffer = (unsigned char *) xmalloc (mem_len);
+	  if (read_inferior_memory (mem_addr, mem_buffer, mem_len) == 0)
+	    bin2hex (mem_buffer, own_buf, mem_len);
 	  else
 	    write_enn (own_buf);
 	}
       else if (own_buf[0] == 'X')
 	{
 	  if (decode_X_packet (&own_buf[1], len - 1, &mem_addr,
-			       &mem_len, &mem_buf) < 0
-	      || write_inferior_memory (mem_addr, mem_buf, mem_len) != 0)
+			       &mem_len, &mem_buffer) < 0
+	      || write_inferior_memory (mem_addr, mem_buffer, mem_len) != 0)
 	    write_enn (own_buf);
 	  else
 	    write_ok (own_buf);
 	}
       else
 	{
-	  decode_M_packet (&own_buf[1], &mem_addr, &mem_len, &mem_buf);
-	  if (write_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
+	  decode_M_packet (&own_buf[1], &mem_addr, &mem_len, &mem_buffer);
+	  if (write_inferior_memory (mem_addr, mem_buffer, mem_len) == 0)
 	    write_ok (own_buf);
 	  else
 	    write_enn (own_buf);
 	}
-      free (mem_buf);
+      free (mem_buffer);
       if (putpkt (own_buf) < 0)
 	return -1;
	       len = getpkt (own_buf);
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 8f097e5..ec408d3 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -119,7 +119,7 @@ int disable_packet_qfThreadInfo;
 static struct target_waitstatus last_status;
 static ptid_t last_ptid;

-static char *own_buf;
+static char *own_buffer;
 static unsigned char *mem_buf;

 /* A sub-class of 'struct notif_event' for stop, holding information
@@ -278,7 +278,7 @@ start_inferior (char **argv)
 		break;

 	      current_thread->last_resume_kind = resume_stop;
-	      current_thread->last_status = last_status;
+	      current_thread->last_waitstatus = last_status;
 	    }
 	  while (last_status.value.sig != GDB_SIGNAL_TRAP);
 	}
@@ -296,7 +296,7 @@ start_inferior (char **argv)
       && last_status.kind != TARGET_WAITKIND_SIGNALLED)
     {
       current_thread->last_resume_kind = resume_stop;
-      current_thread->last_status = last_status;
+      current_thread->last_waitstatus = last_status;
     }
   else
     mourn_inferior (find_process_pid (ptid_get_pid (last_ptid)));
@@ -333,7 +333,7 @@ attach_inferior (int pid)
 	last_status.value.sig = GDB_SIGNAL_TRAP;

       current_thread->last_resume_kind = resume_stop;
-      current_thread->last_status = last_status;
+      current_thread->last_waitstatus = last_status;
     }

   return 0;
@@ -1658,20 +1658,20 @@ handle_qxfer_btrace (const char *annex,
   if (ptid_equal (general_thread, null_ptid)
       || ptid_equal (general_thread, minus_one_ptid))
     {
-      strcpy (own_buf, "E.Must select a single thread.");
+      strcpy (own_buffer, "E.Must select a single thread.");
       return -3;
     }

   thread = find_thread_ptid (general_thread);
   if (thread == NULL)
     {
-      strcpy (own_buf, "E.No such thread.");
+      strcpy (own_buffer, "E.No such thread.");
       return -3;
     }

   if (thread->btrace == NULL)
     {
-      strcpy (own_buf, "E.Btrace not enabled.");
+      strcpy (own_buffer, "E.Btrace not enabled.");
       return -3;
     }

@@ -1683,7 +1683,7 @@ handle_qxfer_btrace (const char *annex,
     type = BTRACE_READ_DELTA;
   else
     {
-      strcpy (own_buf, "E.Bad annex.");
+      strcpy (own_buffer, "E.Bad annex.");
       return -3;
     }

@@ -1694,7 +1694,7 @@ handle_qxfer_btrace (const char *annex,
       result = target_read_btrace (thread->btrace, &cache, type);
       if (result != 0)
 	{
-	  memcpy (own_buf, cache.buffer, cache.used_size);
+	  memcpy (own_buffer, cache.buffer, cache.used_size);
 	  return -3;
 	}
     }
@@ -1732,20 +1732,20 @@ handle_qxfer_btrace_conf (const char *annex,
   if (ptid_equal (general_thread, null_ptid)
       || ptid_equal (general_thread, minus_one_ptid))
     {
-      strcpy (own_buf, "E.Must select a single thread.");
+      strcpy (own_buffer, "E.Must select a single thread.");
       return -3;
     }

   thread = find_thread_ptid (general_thread);
   if (thread == NULL)
     {
-      strcpy (own_buf, "E.No such thread.");
+      strcpy (own_buffer, "E.No such thread.");
       return -3;
     }

   if (thread->btrace == NULL)
     {
-      strcpy (own_buf, "E.Btrace not enabled.");
+      strcpy (own_buffer, "E.Btrace not enabled.");
       return -3;
     }

@@ -1756,7 +1756,7 @@ handle_qxfer_btrace_conf (const char *annex,
       result = target_read_btrace_conf (thread->btrace, &cache);
       if (result != 0)
 	{
-	  memcpy (own_buf, cache.buffer, cache.used_size);
+	  memcpy (own_buffer, cache.buffer, cache.used_size);
 	  return -3;
 	}
     }
@@ -2582,9 +2582,9 @@ handle_pending_status (const struct thread_resume *resumption,
     {
       thread->status_pending_p = 0;

-      last_status = thread->last_status;
+      last_status = thread->last_waitstatus;
       last_ptid = thread->entry.id;
-      prepare_resume_reply (own_buf, last_ptid, &last_status);
+      prepare_resume_reply (own_buffer, last_ptid, &last_status);
       return 1;
     }
   return 0;
@@ -2723,7 +2723,7 @@ resume (struct thread_resume *actions, size_t num_actions)
   (*the_target->resume) (actions, num_actions);

   if (non_stop)
-    write_ok (own_buf);
+    write_ok (own_buffer);
   else
     {
       last_ptid = mywait (minus_one_ptid, &last_status, 0, 1);
@@ -2733,7 +2733,7 @@ resume (struct thread_resume *actions, size_t num_actions)
 	{
 	  /* The client does not support this stop reply.  At least
 	     return error.  */
-	  sprintf (own_buf, "E.No unwaited-for children left.");
+	  sprintf (own_buffer, "E.No unwaited-for children left.");
 	  disable_async_io ();
 	  return;
 	}
@@ -2741,14 +2741,14 @@ resume (struct thread_resume *actions, size_t num_actions)
       if (last_status.kind != TARGET_WAITKIND_EXITED
           && last_status.kind != TARGET_WAITKIND_SIGNALLED
 	  && last_status.kind != TARGET_WAITKIND_NO_RESUMED)
-	current_thread->last_status = last_status;
+	current_thread->last_waitstatus = last_status;

       /* From the client's perspective, all-stop mode always stops all
 	 threads implicitly (and the target backend has already done
 	 so by now).  Tag all threads as "want-stopped", so we don't
 	 resume them implicitly without the client telling us to.  */
       gdb_wants_all_threads_stopped ();
-      prepare_resume_reply (own_buf, last_ptid, &last_status);
+      prepare_resume_reply (own_buffer, last_ptid, &last_status);
       disable_async_io ();

       if (last_status.kind == TARGET_WAITKIND_EXITED
@@ -3048,7 +3048,7 @@ queue_stop_reply_callback (struct inferior_list_entry *entry, void *arg)
       struct vstop_notif *new_notif = XNEW (struct vstop_notif);

       new_notif->ptid = entry->id;
-      new_notif->status = thread->last_status;
+      new_notif->status = thread->last_waitstatus;
       /* Pass the last stop reply back to GDB, but don't notify
 	 yet.  */
       notif_event_enque (&notif_stop,
@@ -3061,7 +3061,7 @@ queue_stop_reply_callback (struct inferior_list_entry *entry, void *arg)
 	  if (debug_threads)
 	    {
 	      char *status_string
-		= target_waitstatus_to_string (&thread->last_status);
+		= target_waitstatus_to_string (&thread->last_waitstatus);

 	      debug_printf ("Reporting thread %s as already stopped with %s\n",
 			    target_pid_to_str (entry->id),
@@ -3070,11 +3070,11 @@ queue_stop_reply_callback (struct inferior_list_entry *entry, void *arg)
 	      xfree (status_string);
 	    }

-	  gdb_assert (thread->last_status.kind != TARGET_WAITKIND_IGNORE);
+	  gdb_assert (thread->last_waitstatus.kind != TARGET_WAITKIND_IGNORE);

 	  /* Pass the last stop reply back to GDB, but don't notify
 	     yet.  */
-	  queue_stop_reply (entry->id, &thread->last_status);
+	  queue_stop_reply (entry->id, &thread->last_waitstatus);
 	}
     }

@@ -3092,12 +3092,12 @@ gdb_wants_thread_stopped (struct inferior_list_entry *entry)

   thread->last_resume_kind = resume_stop;

-  if (thread->last_status.kind == TARGET_WAITKIND_IGNORE)
+  if (thread->last_waitstatus.kind == TARGET_WAITKIND_IGNORE)
     {
       /* Most threads are stopped implicitly (all-stop); tag that with
 	 signal 0.  */
-      thread->last_status.kind = TARGET_WAITKIND_STOPPED;
-      thread->last_status.value.sig = GDB_SIGNAL_0;
+      thread->last_waitstatus.kind = TARGET_WAITKIND_STOPPED;
+      thread->last_waitstatus.value.sig = GDB_SIGNAL_0;
     }
 }

@@ -3138,15 +3138,15 @@ set_pending_status_callback (struct inferior_list_entry *entry)
 {
   struct thread_info *thread = (struct thread_info *) entry;

-  if (thread->last_status.kind != TARGET_WAITKIND_STOPPED
-      || (thread->last_status.value.sig != GDB_SIGNAL_0
+  if (thread->last_waitstatus.kind != TARGET_WAITKIND_STOPPED
+      || (thread->last_waitstatus.value.sig != GDB_SIGNAL_0
 	  /* A breakpoint, watchpoint or finished step from a previous
 	     GDB run isn't considered interesting for a new GDB run.
 	     If we left those pending, the new GDB could consider them
 	     random SIGTRAPs.  This leaves out real async traps.  We'd
 	     have to peek into the (target-specific) siginfo to
 	     distinguish those.  */
-	  && thread->last_status.value.sig != GDB_SIGNAL_TRAP))
+	  && thread->last_waitstatus.value.sig != GDB_SIGNAL_TRAP))
     thread->status_pending_p = 1;
 }

@@ -3229,8 +3229,8 @@ handle_status (char *own_buf)
 	  general_thread = thread->id;
 	  set_desired_thread (1);

-	  gdb_assert (tp->last_status.kind != TARGET_WAITKIND_IGNORE);
-	  prepare_resume_reply (own_buf, tp->entry.id, &tp->last_status);
+	  gdb_assert (tp->last_waitstatus.kind != TARGET_WAITKIND_IGNORE);
+	  prepare_resume_reply (own_buf, tp->entry.id, &tp->last_waitstatus);
 	}
       else
 	strcpy (own_buf, "W00");
@@ -3618,7 +3618,7 @@ captured_main (int argc, char *argv[])
     initialize_tracepoint ();
   initialize_notif ();

-  own_buf = (char *) xmalloc (PBUFSIZ + 1);
+  own_buffer = (char *) xmalloc (PBUFSIZ + 1);
   mem_buf = (unsigned char *) xmalloc (PBUFSIZ);

   if (pid == 0 && *next_arg != NULL)
@@ -3754,8 +3754,8 @@ captured_main (int argc, char *argv[])

 	  if (response_needed)
 	    {
-	      write_enn (own_buf);
-	      putpkt (own_buf);
+	      write_enn (own_buffer);
+	      putpkt (own_buffer);
 	    }

 	  if (run_once)
@@ -3873,7 +3873,7 @@ process_serial_event (void)
   disable_async_io ();

   response_needed = 0;
-  packet_len = getpkt (own_buf);
+  packet_len = getpkt (own_buffer);
   if (packet_len <= 0)
     {
       remote_close ();
@@ -3883,22 +3883,22 @@ process_serial_event (void)
   response_needed = 1;

   i = 0;
-  ch = own_buf[i++];
+  ch = own_buffer[i++];
   switch (ch)
     {
     case 'q':
-      handle_query (own_buf, packet_len, &new_packet_len);
+      handle_query (own_buffer, packet_len, &new_packet_len);
       break;
     case 'Q':
-      handle_general_set (own_buf);
+      handle_general_set (own_buffer);
       break;
     case 'D':
-      require_running (own_buf);
+      require_running (own_buffer);

       if (multi_process)
 	{
 	  i++; /* skip ';' */
-	  pid = strtol (&own_buf[i], NULL, 16);
+	  pid = strtol (&own_buffer[i], NULL, 16);
 	}
       else
 	pid = ptid_get_pid (current_ptid);
@@ -3910,7 +3910,7 @@ process_serial_event (void)

 	  if (process == NULL)
 	    {
-	      write_enn (own_buf);
+	      write_enn (own_buffer);
 	      break;
 	    }

@@ -3946,18 +3946,18 @@ process_serial_event (void)
 	  resume_info.sig = 0;
 	  (*the_target->resume) (&resume_info, 1);

-	  write_ok (own_buf);
+	  write_ok (own_buffer);
 	  break; /* from switch/case */
 	}

       fprintf (stderr, "Detaching from process %d\n", pid);
       stop_tracing ();
       if (detach_inferior (pid) != 0)
-	write_enn (own_buf);
+	write_enn (own_buffer);
       else
 	{
 	  discard_queued_stop_replies (pid_to_ptid (pid));
-	  write_ok (own_buf);
+	  write_ok (own_buffer);

 	  if (extended_protocol || target_running ())
 	    {
@@ -3972,7 +3972,7 @@ process_serial_event (void)
 	    }
 	  else
 	    {
-	      putpkt (own_buf);
+	      putpkt (own_buffer);
 	      remote_close ();

 	      /* If we are attached, then we can exit.  Otherwise, we
@@ -3985,20 +3985,20 @@ process_serial_event (void)
       break;
     case '!':
       extended_protocol = 1;
-      write_ok (own_buf);
+      write_ok (own_buffer);
       break;
     case '?':
-      handle_status (own_buf);
+      handle_status (own_buffer);
       break;
     case 'H':
-      if (own_buf[1] == 'c' || own_buf[1] == 'g' || own_buf[1] == 's')
+ if (own_buffer[1] == 'c' || own_buffer[1] == 'g' || own_buffer[1] == 's')
 	{
 	  ptid_t gdb_id, thread_id;
 	  int pid;

-	  require_running (own_buf);
+	  require_running (own_buffer);

-	  gdb_id = read_ptid (&own_buf[2], NULL);
+	  gdb_id = read_ptid (&own_buffer[2], NULL);

 	  pid = ptid_get_pid (gdb_id);

@@ -4015,7 +4015,7 @@ process_serial_event (void)
 						      &pid);
 	      if (!thread)
 		{
-		  write_enn (own_buf);
+		  write_enn (own_buffer);
 		  break;
 		}

@@ -4026,12 +4026,12 @@ process_serial_event (void)
 	      thread_id = gdb_id_to_thread_id (gdb_id);
 	      if (ptid_equal (thread_id, null_ptid))
 		{
-		  write_enn (own_buf);
+		  write_enn (own_buffer);
 		  break;
 		}
 	    }

-	  if (own_buf[1] == 'g')
+	  if (own_buffer[1] == 'g')
 	    {
 	      if (ptid_equal (thread_id, null_ptid))
 		{
@@ -4050,20 +4050,20 @@ process_serial_event (void)
 	      set_desired_thread (1);
 	      gdb_assert (current_thread != NULL);
 	    }
-	  else if (own_buf[1] == 'c')
+	  else if (own_buffer[1] == 'c')
 	    cont_thread = thread_id;

-	  write_ok (own_buf);
+	  write_ok (own_buffer);
 	}
       else
 	{
 	  /* Silently ignore it so that gdb can extend the protocol
 	     without compatibility headaches.  */
-	  own_buf[0] = '\0';
+	  own_buffer[0] = '\0';
 	}
       break;
     case 'g':
-      require_running (own_buf);
+      require_running (own_buffer);
       if (current_traceframe >= 0)
 	{
 	  struct regcache *regcache
@@ -4071,9 +4071,9 @@ process_serial_event (void)

 	  if (fetch_traceframe_registers (current_traceframe,
 					  regcache, -1) == 0)
-	    registers_to_string (regcache, own_buf);
+	    registers_to_string (regcache, own_buffer);
 	  else
-	    write_enn (own_buf);
+	    write_enn (own_buffer);
 	  free_register_cache (regcache);
 	}
       else
@@ -4081,85 +4081,85 @@ process_serial_event (void)
 	  struct regcache *regcache;

 	  if (!set_desired_thread (1))
-	    write_enn (own_buf);
+	    write_enn (own_buffer);
 	  else
 	    {
 	      regcache = get_thread_regcache (current_thread, 1);
-	      registers_to_string (regcache, own_buf);
+	      registers_to_string (regcache, own_buffer);
 	    }
 	}
       break;
     case 'G':
-      require_running (own_buf);
+      require_running (own_buffer);
       if (current_traceframe >= 0)
-	write_enn (own_buf);
+	write_enn (own_buffer);
       else
 	{
 	  struct regcache *regcache;

 	  if (!set_desired_thread (1))
-	    write_enn (own_buf);
+	    write_enn (own_buffer);
 	  else
 	    {
 	      regcache = get_thread_regcache (current_thread, 1);
-	      registers_from_string (regcache, &own_buf[1]);
-	      write_ok (own_buf);
+	      registers_from_string (regcache, &own_buffer[1]);
+	      write_ok (own_buffer);
 	    }
 	}
       break;
     case 'm':
-      require_running (own_buf);
-      decode_m_packet (&own_buf[1], &mem_addr, &len);
+      require_running (own_buffer);
+      decode_m_packet (&own_buffer[1], &mem_addr, &len);
       res = gdb_read_memory (mem_addr, mem_buf, len);
       if (res < 0)
-	write_enn (own_buf);
+	write_enn (own_buffer);
       else
-	bin2hex (mem_buf, own_buf, res);
+	bin2hex (mem_buf, own_buffer, res);
       break;
     case 'M':
-      require_running (own_buf);
-      decode_M_packet (&own_buf[1], &mem_addr, &len, &mem_buf);
+      require_running (own_buffer);
+      decode_M_packet (&own_buffer[1], &mem_addr, &len, &mem_buf);
       if (gdb_write_memory (mem_addr, mem_buf, len) == 0)
-	write_ok (own_buf);
+	write_ok (own_buffer);
       else
-	write_enn (own_buf);
+	write_enn (own_buffer);
       break;
     case 'X':
-      require_running (own_buf);
-      if (decode_X_packet (&own_buf[1], packet_len - 1,
+      require_running (own_buffer);
+      if (decode_X_packet (&own_buffer[1], packet_len - 1,
 			   &mem_addr, &len, &mem_buf) < 0
 	  || gdb_write_memory (mem_addr, mem_buf, len) != 0)
-	write_enn (own_buf);
+	write_enn (own_buffer);
       else
-	write_ok (own_buf);
+	write_ok (own_buffer);
       break;
     case 'C':
-      require_running (own_buf);
-      hex2bin (own_buf + 1, &sig, 1);
+      require_running (own_buffer);
+      hex2bin (own_buffer + 1, &sig, 1);
       if (gdb_signal_to_host_p ((enum gdb_signal) sig))
 	signal = gdb_signal_to_host ((enum gdb_signal) sig);
       else
 	signal = 0;
-      myresume (own_buf, 0, signal);
+      myresume (own_buffer, 0, signal);
       break;
     case 'S':
-      require_running (own_buf);
-      hex2bin (own_buf + 1, &sig, 1);
+      require_running (own_buffer);
+      hex2bin (own_buffer + 1, &sig, 1);
       if (gdb_signal_to_host_p ((enum gdb_signal) sig))
 	signal = gdb_signal_to_host ((enum gdb_signal) sig);
       else
 	signal = 0;
-      myresume (own_buf, 1, signal);
+      myresume (own_buffer, 1, signal);
       break;
     case 'c':
-      require_running (own_buf);
+      require_running (own_buffer);
       signal = 0;
-      myresume (own_buf, 0, signal);
+      myresume (own_buffer, 0, signal);
       break;
     case 's':
-      require_running (own_buf);
+      require_running (own_buffer);
       signal = 0;
-      myresume (own_buf, 1, signal);
+      myresume (own_buffer, 1, signal);
       break;
     case 'Z':  /* insert_ ... */
       /* Fallthrough.  */
@@ -4168,10 +4168,10 @@ process_serial_event (void)
 	char *dataptr;
 	ULONGEST addr;
 	int kind;
-	char type = own_buf[1];
+	char type = own_buffer[1];
 	int res;
 	const int insert = ch == 'Z';
-	char *p = &own_buf[3];
+	char *p = &own_buffer[3];

 	p = unpack_varlen_hex (p, &addr);
 	kind = strtol (p + 1, &dataptr, 16);
@@ -4198,12 +4198,12 @@ process_serial_event (void)
 	  res = delete_gdb_breakpoint (type, addr, kind);

 	if (res == 0)
-	  write_ok (own_buf);
+	  write_ok (own_buffer);
 	else if (res == 1)
 	  /* Unsupported.  */
-	  own_buf[0] = '\0';
+	  own_buffer[0] = '\0';
 	else
-	  write_enn (own_buf);
+	  write_enn (own_buffer);
 	break;
       }
     case 'k':
@@ -4231,20 +4231,20 @@ process_serial_event (void)
       {
 	ptid_t gdb_id, thread_id;

-	require_running (own_buf);
+	require_running (own_buffer);

-	gdb_id = read_ptid (&own_buf[1], NULL);
+	gdb_id = read_ptid (&own_buffer[1], NULL);
 	thread_id = gdb_id_to_thread_id (gdb_id);
 	if (ptid_equal (thread_id, null_ptid))
 	  {
-	    write_enn (own_buf);
+	    write_enn (own_buffer);
 	    break;
 	  }

 	if (mythread_alive (thread_id))
-	  write_ok (own_buf);
+	  write_ok (own_buffer);
 	else
-	  write_enn (own_buf);
+	  write_enn (own_buffer);
       }
       break;
     case 'R':
@@ -4287,26 +4287,26 @@ process_serial_event (void)
 	  /* It is a request we don't understand.  Respond with an
 	     empty packet so that gdb knows that we don't support this
 	     request.  */
-	  own_buf[0] = '\0';
+	  own_buffer[0] = '\0';
 	  break;
 	}
     case 'v':
       /* Extended (long) request.  */
-      handle_v_requests (own_buf, packet_len, &new_packet_len);
+      handle_v_requests (own_buffer, packet_len, &new_packet_len);
       break;

     default:
       /* It is a request we don't understand.  Respond with an empty
 	 packet so that gdb knows that we don't support this
 	 request.  */
-      own_buf[0] = '\0';
+      own_buffer[0] = '\0';
       break;
     }

   if (new_packet_len != -1)
-    putpkt_binary (own_buf, new_packet_len);
+    putpkt_binary (own_buffer, new_packet_len);
   else
-    putpkt (own_buf);
+    putpkt (own_buffer);

   response_needed = 0;

@@ -4384,7 +4384,7 @@ handle_target_event (int err, gdb_client_data client_data)
 	     "want-stopped" state to what the client wants, until it
 	     gets a new resume action.  */
 	  current_thread->last_resume_kind = resume_stop;
-	  current_thread->last_status = last_status;
+	  current_thread->last_waitstatus = last_status;
 	}

       if (forward_event)
diff --git a/gdb/nat/linux-personality.h b/gdb/nat/linux-personality.h
index 009e614..5f7fa8b 100644
--- a/gdb/nat/linux-personality.h
+++ b/gdb/nat/linux-personality.h
@@ -26,6 +26,6 @@
    re-enable the inferior's address space randomization.  */

 extern struct cleanup *maybe_disable_address_space_randomization
-  (int disable_randomization);
+  (int disable_randomization_p);

 #endif /* ! NAT_LINUX_PERSONALITY_H */



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