[PATCH 08/15] Support in remote target.

Yao Qi yao@codesourcery.com
Thu Apr 12 06:30:00 GMT 2012


This patch is to support remote target.

gdb:

2012-04-12  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_is_non_stop_p): New.
	(init_remote_ops): Install remote_is_non_stop_p.
	(remote_add_inferior): Set tp->control.resumed to 1.
	(add_current_inferior_and_thread): Likewise.
	(extended_remote_attach_1): Likewise.
---
 gdb/remote.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index caf6116..f1f82eb 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1506,8 +1506,9 @@ remote_add_inferior (int fake_pid_p, int pid, int attached)
 static void
 remote_add_thread (ptid_t ptid, int running)
 {
-  add_thread (ptid);
+  struct thread_info *tp = add_thread (ptid);
 
+  tp->control.resumed = 1;
   set_executing (ptid, running);
   set_running (ptid, running);
 }
@@ -3227,6 +3228,7 @@ add_current_inferior_and_thread (void)
   struct remote_state *rs = get_remote_state ();
   int fake_pid_p = 0;
   ptid_t ptid;
+  struct thread_info *tp;
 
   inferior_ptid = null_ptid;
 
@@ -3252,7 +3254,8 @@ add_current_inferior_and_thread (void)
   remote_add_inferior (fake_pid_p, ptid_get_pid (inferior_ptid), -1);
 
   /* Add the main thread.  */
-  add_thread_silent (inferior_ptid);
+  tp = add_thread_silent (inferior_ptid);
+  tp->control.resumed = 1;
 }
 
 static void
@@ -4441,11 +4444,14 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
     }
   else
     {
+      struct thread_info *tp;
+
       /* Now, if we have thread information, update inferior_ptid.  */
       inferior_ptid = remote_current_thread (inferior_ptid);
 
       /* Add the main thread to the thread list.  */
-      add_thread_silent (inferior_ptid);
+      tp = add_thread_silent (inferior_ptid);
+      tp->control.resumed = 1;
     }
 
   /* Next, if the target can specify a description, read it.  We do
@@ -10900,6 +10906,12 @@ remote_can_use_agent (void)
   return (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE);
 }
 
+static int
+remote_is_non_stop_p (void)
+{
+  return non_stop;
+}
+
 static void
 init_remote_ops (void)
 {
@@ -10965,6 +10977,7 @@ Specify the serial device it is connected to\n\
   remote_ops.to_can_async_p = remote_can_async_p;
   remote_ops.to_is_async_p = remote_is_async_p;
   remote_ops.to_async = remote_async;
+  remote_ops.to_is_non_stop_p = remote_is_non_stop_p;
   remote_ops.to_terminal_inferior = remote_terminal_inferior;
   remote_ops.to_terminal_ours = remote_terminal_ours;
   remote_ops.to_supports_non_stop = remote_supports_non_stop;
-- 
1.7.0.4



More information about the Gdb-patches mailing list