* inferior.h (read_sp): Remove prototype.
[deliverable/binutils-gdb.git] / gdb / gnu-nat.c
index 36932a764762ad2fe23815a897c7ccc42e9f0680..80ceb9075ad5fb42e0d08370e0aa8e69806f4104 100644 (file)
@@ -1,5 +1,5 @@
 /* Interface GDB to the GNU Hurd.
-   Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2006, 2007
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -20,8 +20,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
  */
 
 #include <ctype.h>
@@ -45,6 +45,9 @@
 #include <hurd/msg.h>
 #include <hurd/msg_request.h>
 #include <hurd/process.h>
+/* Defined in <hurd/process.h>, but we need forward declarations from
+   <hurd/process_request.h> as well.  */
+#undef _process_user_
 #include <hurd/process_request.h>
 #include <hurd/signal.h>
 #include <hurd/sigpreempt.h>
@@ -1050,7 +1053,10 @@ inf_validate_procs (struct inf *inf)
            proc_debug (thread, "died!");
            thread->port = MACH_PORT_NULL;
            thread = _proc_free (thread);       /* THREAD is dead.  */
-           (last ? last->next : inf->threads) = thread;
+           if (last)
+             last->next = thread;
+           else
+             inf->threads = thread;
          }
       }
 
@@ -1063,7 +1069,10 @@ inf_validate_procs (struct inf *inf)
          /* THREADS[I] is a thread we don't know about yet!  */
          {
            thread = make_proc (inf, threads[i], next_thread_id++);
-           (last ? last->next : inf->threads) = thread;
+           if (last)
+             last->next = thread;
+           else
+             inf->threads = thread;
            last = thread;
            proc_debug (thread, "new thread: %d", threads[i]);
            add_thread (pid_to_ptid (thread->tid));     /* Tell GDB's generic thread code.  */
@@ -1972,7 +1981,7 @@ gnu_resume (ptid_t tid, int step, enum target_signal sig)
     {
       struct proc *thread = inf_tid_to_thread (inf, PIDGET (tid));
       if (!thread)
-       error (_("Can't run single thread id %d: no such thread!"));
+       error (_("Can't run single thread id %d: no such thread!"), inf->pid);
       inf_debug (inf, "running one thread: %d/%d", inf->pid, thread->tid);
       inf_set_threads_resume_sc (inf, thread, 0);
     }
@@ -2089,9 +2098,6 @@ gnu_create_inferior (char *exec_file, char *allargs, char **env,
     inf_steal_exc_ports (inf);
   else
     inf_restore_exc_ports (inf);
-
-  /* Here we go!  */
-  proceed ((CORE_ADDR) -1, 0, 0);
 }
 
 /* Mark our target-struct as eligible for stray "run" and "attach"
@@ -2201,11 +2207,8 @@ gnu_terminal_init_inferior (void)
    that registers contains all the registers from the program being
    debugged.  */
 static void
-gnu_prepare_to_store (void)
+gnu_prepare_to_store (struct regcache *regcache)
 {
-#ifdef CHILD_PREPARE_TO_STORE
-  CHILD_PREPARE_TO_STORE ();
-#endif
 }
 
 static void
@@ -2254,7 +2257,7 @@ gnu_read_inferior (task_t task, CORE_ADDR addr, char *myaddr, int length)
   if (err)
     return 0;
 
-  err = hurd_safe_copyin (myaddr, (void *) addr - low_address + copied, length);
+  err = hurd_safe_copyin (myaddr, (void *) (addr - low_address + copied), length);
   if (err)
     {
       warning (_("Read from inferior faulted: %s"), safe_strerror (err));
@@ -2309,7 +2312,7 @@ gnu_write_inferior (task_t task, CORE_ADDR addr, char *myaddr, int length)
 
   deallocate++;
 
-  err = hurd_safe_copyout ((void *) addr - low_address + copied,
+  err = hurd_safe_copyout ((void *) (addr - low_address + copied),
                           myaddr, length);
   CHK_GOTO_OUT ("Write to inferior faulted", err);
 
@@ -2442,7 +2445,7 @@ out:
 /* Return 0 on failure, number of bytes handled otherwise.  TARGET
    is ignored. */
 static int
-gnu_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+gnu_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
                 struct mem_attrib *attrib,
                 struct target_ops *target)
 {
@@ -2578,8 +2581,8 @@ gnu_pid_to_str (ptid_t ptid)
 }
 
 \f
-extern void gnu_store_registers (int regno);
-extern void gnu_fetch_registers (int regno);
+extern void gnu_store_registers (struct regcache *regcache, int regno);
+extern void gnu_fetch_registers (struct regcache *regcache, int regno);
 
 struct target_ops gnu_ops;
 
@@ -3133,10 +3136,10 @@ Show whether exceptions in the inferior process will be trapped."),
           &showlist);
 
   add_prefix_cmd ("task", no_class, set_task_cmd,
-                 "Command prefix for setting task attributes.",
+                 _("Command prefix for setting task attributes."),
                  &set_task_cmd_list, "set task ", 0, &setlist);
   add_prefix_cmd ("task", no_class, show_task_cmd,
-                 "Command prefix for showing task attributes.",
+                 _("Command prefix for showing task attributes."),
                  &show_task_cmd_list, "show task ", 0, &showlist);
 
   add_cmd ("pause", class_run, set_task_pause_cmd, _("\
@@ -3300,17 +3303,17 @@ static void
 add_thread_commands (void)
 {
   add_prefix_cmd ("thread", no_class, set_thread_cmd,
-                 "Command prefix for setting thread properties.",
+                 _("Command prefix for setting thread properties."),
                  &set_thread_cmd_list, "set thread ", 0, &setlist);
   add_prefix_cmd ("default", no_class, show_thread_cmd,
-                 "Command prefix for setting default thread properties.",
+                 _("Command prefix for setting default thread properties."),
                  &set_thread_default_cmd_list, "set thread default ", 0,
                  &set_thread_cmd_list);
   add_prefix_cmd ("thread", no_class, set_thread_default_cmd,
-                 "Command prefix for showing thread properties.",
+                 _("Command prefix for showing thread properties."),
                  &show_thread_cmd_list, "show thread ", 0, &showlist);
   add_prefix_cmd ("default", no_class, show_thread_default_cmd,
-                 "Command prefix for showing default thread properties.",
+                 _("Command prefix for showing default thread properties."),
                  &show_thread_default_cmd_list, "show thread default ", 0,
                  &show_thread_cmd_list);
 
@@ -3371,9 +3374,10 @@ _initialize_gnu_nat (void)
 
   add_task_commands ();
   add_thread_commands ();
-  add_set_cmd ("gnu-debug", class_maintenance,
-              var_boolean, (char *) &gnu_debug_flag,
-              "Set debugging output for the gnu backend.", &maintenancelist);
+  deprecated_add_set_cmd ("gnu-debug", class_maintenance,
+                         var_boolean, (char *) &gnu_debug_flag,
+                         "Set debugging output for the gnu backend.",
+                         &maintenancelist);
 }
 \f
 #ifdef FLUSH_INFERIOR_CACHE
This page took 0.026389 seconds and 4 git commands to generate.