gdbserver: turn target op 'handle_new_gdb_connection' into a method
[deliverable/binutils-gdb.git] / gdbserver / server.cc
index 3fc026f78ebba4db17134befd3b7607e68ed04ff..f427e7706fbb62730636902bd77aaa2fcafab6db 100644 (file)
@@ -740,7 +740,7 @@ handle_general_set (char *own_buf)
        }
 
       req_str = req ? "non-stop" : "all-stop";
-      if (start_non_stop (req) != 0)
+      if (the_target->pt->start_non_stop (req == 1) != 0)
        {
          fprintf (stderr, "Setting %s mode failed\n", req_str);
          write_enn (own_buf);
@@ -1234,7 +1234,7 @@ handle_detach (char *own_buf)
            debug_printf ("Forcing non-stop mode\n");
 
          non_stop = true;
-         start_non_stop (1);
+         the_target->pt->start_non_stop (true);
        }
 
       process->gdb_detached = 1;
@@ -1442,13 +1442,13 @@ handle_qxfer_auxv (const char *annex,
                   gdb_byte *readbuf, const gdb_byte *writebuf,
                   ULONGEST offset, LONGEST len)
 {
-  if (the_target->read_auxv == NULL || writebuf != NULL)
+  if (!the_target->pt->supports_read_auxv () || writebuf != NULL)
     return -2;
 
   if (annex[0] != '\0' || current_thread == NULL)
     return -1;
 
-  return (*the_target->read_auxv) (offset, readbuf, len);
+  return the_target->pt->read_auxv (offset, readbuf, len);
 }
 
 /* Handle qXfer:exec-file:read.  */
@@ -1587,10 +1587,10 @@ handle_qxfer_osdata (const char *annex,
                     gdb_byte *readbuf, const gdb_byte *writebuf,
                     ULONGEST offset, LONGEST len)
 {
-  if (the_target->qxfer_osdata == NULL || writebuf != NULL)
+  if (!the_target->pt->supports_qxfer_osdata () || writebuf != NULL)
     return -2;
 
-  return (*the_target->qxfer_osdata) (annex, readbuf, NULL, offset, len);
+  return the_target->pt->qxfer_osdata (annex, readbuf, NULL, offset, len);
 }
 
 /* Handle qXfer:siginfo:read and qXfer:siginfo:write.  */
@@ -1600,13 +1600,13 @@ handle_qxfer_siginfo (const char *annex,
                      gdb_byte *readbuf, const gdb_byte *writebuf,
                      ULONGEST offset, LONGEST len)
 {
-  if (the_target->qxfer_siginfo == NULL)
+  if (!the_target->pt->supports_qxfer_siginfo ())
     return -2;
 
   if (annex[0] != '\0' || current_thread == NULL)
     return -1;
 
-  return (*the_target->qxfer_siginfo) (annex, readbuf, writebuf, offset, len);
+  return the_target->pt->qxfer_siginfo (annex, readbuf, writebuf, offset, len);
 }
 
 /* Handle qXfer:statictrace:read.  */
@@ -2192,8 +2192,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       if (target_supports_tracepoints ())
        tracepoint_look_up_symbols ();
 
-      if (current_thread != NULL && the_target->look_up_symbols != NULL)
-       (*the_target->look_up_symbols) ();
+      if (current_thread != NULL)
+       the_target->pt->look_up_symbols ();
 
       current_thread = save_thread;
 
@@ -2234,13 +2234,13 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
        }
     }
 
-  if (the_target->read_offsets != NULL
+  if (the_target->pt->supports_read_offsets ()
       && strcmp ("qOffsets", own_buf) == 0)
     {
       CORE_ADDR text, data;
 
       require_running_or_return (own_buf);
-      if (the_target->read_offsets (&text, &data))
+      if (the_target->pt->read_offsets (&text, &data))
        sprintf (own_buf, "Text=%lX;Data=%lX;Bss=%lX",
                 (long)text, (long)data, (long)data);
       else
@@ -2374,10 +2374,10 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
          strcat (own_buf, ";qXfer:libraries:read+");
        }
 
-      if (the_target->read_auxv != NULL)
+      if (the_target->pt->supports_read_auxv ())
        strcat (own_buf, ";qXfer:auxv:read+");
 
-      if (the_target->qxfer_siginfo != NULL)
+      if (the_target->pt->supports_qxfer_siginfo ())
        strcat (own_buf, ";qXfer:siginfo:read+;qXfer:siginfo:write+");
 
       if (the_target->read_loadmap != NULL)
@@ -2392,7 +2392,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
       if (cs.transport_is_reliable)
        strcat (own_buf, ";QStartNoAckMode+");
 
-      if (the_target->qxfer_osdata != NULL)
+      if (the_target->pt->supports_qxfer_osdata ())
        strcat (own_buf, ";qXfer:osdata:read+");
 
       if (target_supports_multi_process ())
@@ -2467,7 +2467,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
     }
 
   /* Thread-local storage support.  */
-  if (the_target->get_tls_address != NULL
+  if (the_target->pt->supports_get_tls_address ()
       && startswith (own_buf, "qGetTLSAddr:"))
     {
       char *p = own_buf + 12;
@@ -2513,8 +2513,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
          if (thread == NULL)
            err = 2;
          else
-           err = the_target->get_tls_address (thread, parts[0], parts[1],
-                                              &address);
+           err = the_target->pt->get_tls_address (thread, parts[0], parts[1],
+                                                  &address);
        }
 
       if (err == 0)
@@ -2847,7 +2847,7 @@ resume (struct thread_resume *actions, size_t num_actions)
       enable_async_io ();
     }
 
-  (*the_target->resume) (actions, num_actions);
+  the_target->pt->resume (actions, num_actions);
 
   if (non_stop)
     write_ok (cs.own_buf);
@@ -3028,7 +3028,7 @@ handle_v_run (char *own_buf)
   free_vector_argv (program_args);
   program_args = new_argv;
 
-  create_inferior (program_path.get (), program_args);
+  target_create_inferior (program_path.get (), program_args);
 
   if (cs.last_status.kind == TARGET_WAITKIND_STOPPED)
     {
@@ -3088,7 +3088,7 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
     {
       if (strcmp (own_buf, "vCtrlC") == 0)
        {
-         (*the_target->request_interrupt) ();
+         the_target->pt->request_interrupt ();
          write_ok (own_buf);
          return;
        }
@@ -3784,7 +3784,7 @@ captured_main (int argc, char *argv[])
       program_args.push_back (NULL);
 
       /* Wait till we are at first instruction in program.  */
-      create_inferior (program_path.get (), program_args);
+      target_create_inferior (program_path.get (), program_args);
 
       /* We are now (hopefully) stopped at the first instruction of
         the target process.  This assumes that the target process was
@@ -3885,7 +3885,7 @@ captured_main (int argc, char *argv[])
                     down without informing GDB.  */
                  if (!non_stop)
                    {
-                     if (start_non_stop (1))
+                     if (the_target->pt->start_non_stop (true))
                        non_stop = 1;
 
                      /* Detaching implicitly resumes all threads;
@@ -4303,7 +4303,7 @@ process_serial_event (void)
          /* Wait till we are at 1st instruction in prog.  */
          if (program_path.get () != NULL)
            {
-             create_inferior (program_path.get (), program_args);
+             target_create_inferior (program_path.get (), program_args);
 
              if (cs.last_status.kind == TARGET_WAITKIND_STOPPED)
                {
This page took 0.027048 seconds and 4 git commands to generate.