* remote.c (remote_write_bytes): Take a const buffer argument.
[deliverable/binutils-gdb.git] / gdb / sol-thread.c
index fe97f6c5d1dd2816dff7af5687ec979d97f1efb4..106ec192ad33c7b1d87ba207f112186636303f4b 100644 (file)
@@ -1,7 +1,7 @@
 /* Solaris threads debugging interface.
 
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+   2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -17,8 +17,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.  */
 
 /* This module implements a sort of half target that sits between the
    machine-independent parts of GDB and the /proc interface (procfs.c)
@@ -64,6 +64,7 @@
 #include "gdbcmd.h"
 #include "gdbcore.h"
 #include "regcache.h"
+#include "solib.h"
 #include "symfile.h"
 
 #include "gdb_string.h"
@@ -273,19 +274,19 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
   if (val == TD_NOTHR)
     return pid_to_ptid (-1);   /* Thread must have terminated.  */
   else if (val != TD_OK)
-    error ("thread_to_lwp: td_ta_map_id2thr %s", td_err_string (val));
+    error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
 
   val = p_td_thr_get_info (&th, &ti);
   if (val == TD_NOTHR)
     return pid_to_ptid (-1);   /* Thread must have terminated.  */
   else if (val != TD_OK)
-    error ("thread_to_lwp: td_thr_get_info: %s", td_err_string (val));
+    error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
 
   if (ti.ti_state != TD_THR_ACTIVE)
     {
       if (default_lwp != -1)
        return pid_to_ptid (default_lwp);
-      error ("thread_to_lwp: thread state not active: %s",
+      error (_("thread_to_lwp: thread state not active: %s"),
             td_state_string (ti.ti_state));
     }
 
@@ -316,19 +317,19 @@ lwp_to_thread (ptid_t lwp)
   if (val == TD_NOTHR)
     return pid_to_ptid (-1);   /* Thread must have terminated.  */
   else if (val != TD_OK)
-    error ("lwp_to_thread: td_ta_map_lwp2thr: %s.", td_err_string (val));
+    error (_("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val));
 
   val = p_td_thr_validate (&th);
   if (val == TD_NOTHR)
     return lwp;                        /* Unknown to libthread; just return LPW,  */
   else if (val != TD_OK)
-    error ("lwp_to_thread: td_thr_validate: %s.", td_err_string (val));
+    error (_("lwp_to_thread: td_thr_validate: %s."), td_err_string (val));
 
   val = p_td_thr_get_info (&th, &ti);
   if (val == TD_NOTHR)
     return pid_to_ptid (-1);   /* Thread must have terminated.  */
   else if (val != TD_OK)
-    error ("lwp_to_thread: td_thr_get_info: %s.", td_err_string (val));
+    error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
 
   return BUILD_THREAD (ti.ti_tid, PIDGET (lwp));
 }
@@ -353,7 +354,7 @@ sol_thread_attach (char *args, int from_tty)
   procfs_ops.to_attach (args, from_tty);
 
   /* Must get symbols from shared libraries before libthread_db can run!  */
-  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0, auto_solib_add);
+  solib_add (NULL, from_tty, (struct target_ops *) 0, auto_solib_add);
 
   if (sol_thread_active)
     {
@@ -408,9 +409,9 @@ sol_thread_resume (ptid_t ptid, int step, enum target_signal signo)
 
       ptid = thread_to_lwp (ptid, -2);
       if (PIDGET (ptid) == -2)         /* Inactive thread.  */
-       error ("This version of Solaris can't start inactive threads.");
+       error (_("This version of Solaris can't start inactive threads."));
       if (info_verbose && PIDGET (ptid) == -1)
-       warning ("Specified thread %ld seems to have terminated",
+       warning (_("Specified thread %ld seems to have terminated"),
                 GET_THREAD (save_ptid));
     }
 
@@ -442,9 +443,9 @@ sol_thread_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
 
       ptid = thread_to_lwp (ptid, -2);
       if (PIDGET (ptid) == -2)         /* Inactive thread.  */
-       error ("This version of Solaris can't start inactive threads.");
+       error (_("This version of Solaris can't start inactive threads."));
       if (info_verbose && PIDGET (ptid) == -1)
-       warning ("Specified thread %ld seems to have terminated",
+       warning (_("Specified thread %ld seems to have terminated"),
                 GET_THREAD (save_ptid));
     }
 
@@ -502,18 +503,18 @@ sol_thread_fetch_registers (int regnum)
   /* Solaris thread: convert INFERIOR_PTID into a td_thrhandle_t.  */
   thread = GET_THREAD (inferior_ptid);
   if (thread == 0)
-    error ("sol_thread_fetch_registers: thread == 0");
+    error (_("sol_thread_fetch_registers: thread == 0"));
 
   val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
   if (val != TD_OK)
-    error ("sol_thread_fetch_registers: td_ta_map_id2thr: %s",
+    error (_("sol_thread_fetch_registers: td_ta_map_id2thr: %s"),
           td_err_string (val));
 
   /* Get the general-purpose registers.  */
 
   val = p_td_thr_getgregs (&thandle, gregset);
   if (val != TD_OK && val != TD_PARTIALREG)
-    error ("sol_thread_fetch_registers: td_thr_getgregs %s",
+    error (_("sol_thread_fetch_registers: td_thr_getgregs %s"),
           td_err_string (val));
 
   /* For SPARC, TD_PARTIALREG means that only %i0...%i7, %l0..%l7, %pc
@@ -523,7 +524,7 @@ sol_thread_fetch_registers (int regnum)
 
   val = p_td_thr_getfpregs (&thandle, &fpregset);
   if (val != TD_OK && val != TD_NOFPREGS)
-    error ("sol_thread_fetch_registers: td_thr_getfpregs %s",
+    error (_("sol_thread_fetch_registers: td_thr_getfpregs %s"),
           td_err_string (val));
 
   /* Note that we must call supply_gregset and supply_fpregset *after*
@@ -537,7 +538,7 @@ sol_thread_fetch_registers (int regnum)
   /* FIXME: libthread_db doesn't seem to handle this right.  */
   val = td_thr_getxregsize (&thandle, &xregsize);
   if (val != TD_OK && val != TD_NOXREGS)
-    error ("sol_thread_fetch_registers: td_thr_getxregsize %s",
+    error (_("sol_thread_fetch_registers: td_thr_getxregsize %s"),
           td_err_string (val));
 
   if (val == TD_OK)
@@ -545,7 +546,7 @@ sol_thread_fetch_registers (int regnum)
       xregset = alloca (xregsize);
       val = td_thr_getxregs (&thandle, xregset);
       if (val != TD_OK)
-       error ("sol_thread_fetch_registers: td_thr_getxregs %s",
+       error (_("sol_thread_fetch_registers: td_thr_getxregs %s"),
               td_err_string (val));
     }
 #endif
@@ -576,7 +577,7 @@ sol_thread_store_registers (int regnum)
 
   val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
   if (val != TD_OK)
-    error ("sol_thread_store_registers: td_ta_map_id2thr %s",
+    error (_("sol_thread_store_registers: td_ta_map_id2thr %s"),
           td_err_string (val));
 
   if (regnum != -1)
@@ -585,15 +586,15 @@ sol_thread_store_registers (int regnum)
       char old_value[MAX_REGISTER_SIZE];
 
       /* Save new register value.  */
-      regcache_collect (regnum, old_value);
+      regcache_raw_collect (current_regcache, regnum, old_value);
 
       val = p_td_thr_getgregs (&thandle, gregset);
       if (val != TD_OK)
-       error ("sol_thread_store_registers: td_thr_getgregs %s",
+       error (_("sol_thread_store_registers: td_thr_getgregs %s"),
               td_err_string (val));
       val = p_td_thr_getfpregs (&thandle, &fpregset);
       if (val != TD_OK)
-       error ("sol_thread_store_registers: td_thr_getfpregs %s",
+       error (_("sol_thread_store_registers: td_thr_getfpregs %s"),
               td_err_string (val));
 
       /* Restore new register value.  */
@@ -603,7 +604,7 @@ sol_thread_store_registers (int regnum)
       /* FIXME: libthread_db doesn't seem to handle this right.  */
       val = td_thr_getxregsize (&thandle, &xregsize);
       if (val != TD_OK && val != TD_NOXREGS)
-       error ("sol_thread_store_registers: td_thr_getxregsize %s",
+       error (_("sol_thread_store_registers: td_thr_getxregsize %s"),
               td_err_string (val));
 
       if (val == TD_OK)
@@ -611,7 +612,7 @@ sol_thread_store_registers (int regnum)
          xregset = alloca (xregsize);
          val = td_thr_getxregs (&thandle, xregset);
          if (val != TD_OK)
-           error ("sol_thread_store_registers: td_thr_getxregs %s",
+           error (_("sol_thread_store_registers: td_thr_getxregs %s"),
                   td_err_string (val));
        }
 #endif
@@ -622,18 +623,18 @@ sol_thread_store_registers (int regnum)
 
   val = p_td_thr_setgregs (&thandle, gregset);
   if (val != TD_OK)
-    error ("sol_thread_store_registers: td_thr_setgregs %s",
+    error (_("sol_thread_store_registers: td_thr_setgregs %s"),
           td_err_string (val));
   val = p_td_thr_setfpregs (&thandle, &fpregset);
   if (val != TD_OK)
-    error ("sol_thread_store_registers: td_thr_setfpregs %s",
+    error (_("sol_thread_store_registers: td_thr_setfpregs %s"),
           td_err_string (val));
 
 #if 0
   /* FIXME: libthread_db doesn't seem to handle this right.  */
   val = td_thr_getxregsize (&thandle, &xregsize);
   if (val != TD_OK && val != TD_NOXREGS)
-    error ("sol_thread_store_registers: td_thr_getxregsize %s",
+    error (_("sol_thread_store_registers: td_thr_getxregsize %s"),
           td_err_string (val));
 
   /* ??? Should probably do something about writing the xregs here,
@@ -660,8 +661,8 @@ sol_thread_prepare_to_store (void)
    Returns the number of bytes transferred.  */
 
 static int
-sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
-                       struct mem_attrib *attrib,
+sol_thread_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
+                       int dowrite, struct mem_attrib *attrib,
                        struct target_ops *target)
 {
   int retval;
@@ -680,11 +681,11 @@ sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
     }
 
   if (target_has_execution)
-    retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len,
-                                       dowrite, attrib, target);
+    retval = procfs_ops.deprecated_xfer_memory (memaddr, myaddr, len,
+                                               dowrite, attrib, target);
   else
-    retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
-                                          dowrite, attrib, target);
+    retval = orig_core_ops.deprecated_xfer_memory (memaddr, myaddr, len,
+                                                  dowrite, attrib, target);
 
   do_cleanups (old_chain);
 
@@ -697,8 +698,9 @@ sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
 
 static LONGEST
 sol_thread_xfer_partial (struct target_ops *ops, enum target_object object,
-                         const char *annex, void *readbuf,
-                         const void *writebuf, ULONGEST offset, LONGEST len)
+                         const char *annex, gdb_byte *readbuf,
+                         const gdb_byte *writebuf,
+                        ULONGEST offset, LONGEST len)
 {
   int retval;
   struct cleanup *old_chain;
@@ -807,7 +809,7 @@ sol_thread_new_objfile (struct objfile *objfile)
   val = p_td_init ();
   if (val != TD_OK)
     {
-      warning ("sol_thread_new_objfile: td_init: %s", td_err_string (val));
+      warning (_("sol_thread_new_objfile: td_init: %s"), td_err_string (val));
       goto quit;
     }
 
@@ -816,7 +818,7 @@ sol_thread_new_objfile (struct objfile *objfile)
     goto quit;
   else if (val != TD_OK)
     {
-      warning ("sol_thread_new_objfile: td_ta_new: %s", td_err_string (val));
+      warning (_("sol_thread_new_objfile: td_ta_new: %s"), td_err_string (val));
       goto quit;
     }
 
@@ -1014,11 +1016,11 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
 
       /* FIXME: passing 0 as attrib argument.  */
       if (target_has_execution)
-       cc = procfs_ops.to_xfer_memory (addr, buf, size,
-                                       dowrite, 0, &procfs_ops);
+       cc = procfs_ops.deprecated_xfer_memory (addr, buf, size,
+                                               dowrite, 0, &procfs_ops);
       else
-       cc = orig_core_ops.to_xfer_memory (addr, buf, size,
-                                          dowrite, 0, &core_ops);
+       cc = orig_core_ops.deprecated_xfer_memory (addr, buf, size,
+                                                  dowrite, 0, &core_ops);
 
       if (cc < 0)
        {
@@ -1034,10 +1036,10 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
       else if (cc == 0)
        {
          if (dowrite == 0)
-           warning ("rw_common (): unable to read at addr 0x%lx",
+           warning (_("rw_common (): unable to read at addr 0x%lx"),
                     (long) addr);
          else
-           warning ("rw_common (): unable to write at addr 0x%lx",
+           warning (_("rw_common (): unable to write at addr 0x%lx"),
                     (long) addr);
 
          do_cleanups (old_chain);
@@ -1491,7 +1493,7 @@ info_cb (const td_thrhandle_t *th, void *s)
        printf_filtered ("\n"); /* don't you hate counting newlines? */
     }
   else
-    warning ("info sol-thread: failed to get info for thread.");
+    warning (_("info sol-thread: failed to get info for thread."));
 
   return 0;
 }
@@ -1522,7 +1524,7 @@ sol_make_note_section (bfd *obfd, int *note_size)
 }
 
 static int
-ignore (CORE_ADDR addr, char *contents)
+ignore (struct bp_target_info *bp_tgt)
 {
   return 0;
 }
@@ -1541,7 +1543,7 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_fetch_registers = sol_thread_fetch_registers;
   sol_thread_ops.to_store_registers = sol_thread_store_registers;
   sol_thread_ops.to_prepare_to_store = sol_thread_prepare_to_store;
-  sol_thread_ops.to_xfer_memory = sol_thread_xfer_memory;
+  sol_thread_ops.deprecated_xfer_memory = sol_thread_xfer_memory;
   sol_thread_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_thread_ops.to_files_info = sol_thread_files_info;
   sol_thread_ops.to_insert_breakpoint = memory_insert_breakpoint;
@@ -1584,7 +1586,7 @@ init_sol_core_ops (void)
   sol_core_ops.to_attach = sol_thread_attach;
   sol_core_ops.to_detach = sol_core_detach;
   sol_core_ops.to_fetch_registers = sol_thread_fetch_registers;
-  sol_core_ops.to_xfer_memory = sol_thread_xfer_memory;
+  sol_core_ops.deprecated_xfer_memory = sol_thread_xfer_memory;
   sol_core_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_core_ops.to_files_info = sol_core_files_info;
   sol_core_ops.to_insert_breakpoint = ignore;
@@ -1658,7 +1660,7 @@ _initialize_sol_thread (void)
   procfs_suppress_run = 1;
 
   add_cmd ("sol-threads", class_maintenance, info_solthreads,
-          "Show info on Solaris user threads.\n", &maintenanceinfolist);
+          _("Show info on Solaris user threads."), &maintenanceinfolist);
 
   memcpy (&orig_core_ops, &core_ops, sizeof (struct target_ops));
   memcpy (&core_ops, &sol_core_ops, sizeof (struct target_ops));
This page took 0.049099 seconds and 4 git commands to generate.