Remove regcache_xmalloc
[deliverable/binutils-gdb.git] / gdb / sol-thread.c
index 39dae864a39cfa3fc1d670979534d5f2a6cd5271..d493f7b8d509aef2ba79427ce0a6cbeb5e6a2c42 100644 (file)
@@ -86,7 +86,7 @@ struct ps_prochandle
 struct string_map
 {
   int num;
-  char *str;
+  const char *str;
 };
 
 static struct ps_prochandle main_ph;
@@ -179,7 +179,7 @@ static td_thr_setgregs_ftype *p_td_thr_setgregs;
 /* Return the libthread_db error string associated with ERRCODE.  If
    ERRCODE is unknown, return an appropriate message.  */
 
-static char *
+static const char *
 td_err_string (td_err_e errcode)
 {
   static struct string_map td_err_table[] =
@@ -223,7 +223,7 @@ td_err_string (td_err_e errcode)
 /* Return the libthread_db state string assicoated with STATECODE.
    If STATECODE is unknown, return an appropriate message.  */
 
-static char *
+static const char *
 td_state_string (td_thr_state_e statecode)
 {
   static struct string_map td_thr_state_table[] =
@@ -367,10 +367,9 @@ static void
 sol_thread_resume (struct target_ops *ops,
                   ptid_t ptid, int step, enum gdb_signal signo)
 {
-  struct cleanup *old_chain;
   struct target_ops *beneath = find_target_beneath (ops);
 
-  old_chain = save_inferior_ptid ();
+  scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
   inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
   if (ptid_get_pid (inferior_ptid) == -1)
@@ -389,8 +388,6 @@ sol_thread_resume (struct target_ops *ops,
     }
 
   beneath->to_resume (beneath, ptid, step, signo);
-
-  do_cleanups (old_chain);
 }
 
 /* Wait for any threads to stop.  We may have to convert PTID from a
@@ -403,10 +400,9 @@ sol_thread_wait (struct target_ops *ops,
   ptid_t rtnval;
   ptid_t save_ptid;
   struct target_ops *beneath = find_target_beneath (ops);
-  struct cleanup *old_chain;
 
   save_ptid = inferior_ptid;
-  old_chain = save_inferior_ptid ();
+  scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
   inferior_ptid = thread_to_lwp (inferior_ptid, ptid_get_pid (main_ph.ptid));
   if (ptid_get_pid (inferior_ptid) == -1)
@@ -445,8 +441,6 @@ sol_thread_wait (struct target_ops *ops,
      package being initialized, since that can only happen after we've
      found the shared libs.  */
 
-  do_cleanups (old_chain);
-
   return rtnval;
 }
 
@@ -569,11 +563,9 @@ sol_thread_xfer_partial (struct target_ops *ops, enum target_object object,
                          const gdb_byte *writebuf,
                         ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
 {
-  enum target_xfer_status retval;
-  struct cleanup *old_chain;
   struct target_ops *beneath = find_target_beneath (ops);
 
-  old_chain = save_inferior_ptid ();
+  scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
   if (ptid_tid_p (inferior_ptid) || !target_thread_alive (inferior_ptid))
     {
@@ -585,12 +577,8 @@ sol_thread_xfer_partial (struct target_ops *ops, enum target_object object,
       inferior_ptid = procfs_first_available ();
     }
 
-  retval = beneath->to_xfer_partial (beneath, object, annex, readbuf,
-                                    writebuf, offset, len, xfered_len);
-
-  do_cleanups (old_chain);
-
-  return retval;
+  return beneath->to_xfer_partial (beneath, object, annex, readbuf,
+                                  writebuf, offset, len, xfered_len);
 }
 
 static void
@@ -800,9 +788,8 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
           gdb_byte *buf, int size)
 {
   int ret;
-  struct cleanup *old_chain;
 
-  old_chain = save_inferior_ptid ();
+  scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
 
   if (ptid_tid_p (inferior_ptid) || !target_thread_alive (inferior_ptid))
     {
@@ -826,8 +813,6 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
   else
     ret = target_read_memory (addr, (gdb_byte *) buf, size);
 
-  do_cleanups (old_chain);
-
   return (ret == 0 ? PS_OK : PS_ERR);
 }
 
@@ -1229,9 +1214,6 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_magic = OPS_MAGIC;
 }
 
-/* Silence -Wmissing-prototypes.  */
-extern void _initialize_sol_thread (void);
-
 void
 _initialize_sol_thread (void)
 {
This page took 0.029165 seconds and 4 git commands to generate.