* solist.h (struct target_so_ops): New member clear_so.
[deliverable/binutils-gdb.git] / gdb / sol-thread.c
index b2c1806583d305af876ffd9d769e735ebdfa37e4..f5ea3bebcfbb03a03b0043fbd556c0bbedb37370 100644 (file)
@@ -1,6 +1,6 @@
 /* Solaris threads debugging interface.
 
-   Copyright (C) 1996-2005, 2007-2012 Free Software Foundation, Inc.
+   Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -196,7 +196,8 @@ td_err_string (td_err_e errcode)
     if (td_err_table[i].num == errcode)
       return td_err_table[i].str;
 
-  sprintf (buf, "Unknown libthread_db error code: %d", errcode);
+  xsnprintf (buf, sizeof (buf), "Unknown libthread_db error code: %d",
+            errcode);
 
   return buf;
 }
@@ -227,7 +228,8 @@ td_state_string (td_thr_state_e statecode)
     if (td_thr_state_table[i].num == statecode)
       return td_thr_state_table[i].str;
 
-  sprintf (buf, "Unknown libthread_db state code: %d", statecode);
+  xsnprintf (buf, sizeof (buf), "Unknown libthread_db state code: %d",
+            statecode);
 
   return buf;
 }
@@ -780,7 +782,7 @@ ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *ld_object_name,
 
 static ps_err_e
 rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
-          char *buf, int size)
+          gdb_byte *buf, int size)
 {
   int ret;
   struct cleanup *old_chain;
@@ -805,9 +807,9 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
 #endif
 
   if (dowrite)
-    ret = target_write_memory (addr, buf, size);
+    ret = target_write_memory (addr, (gdb_byte *) buf, size);
   else
-    ret = target_read_memory (addr, buf, size);
+    ret = target_read_memory (addr, (gdb_byte *) buf, size);
 
   do_cleanups (old_chain);
 
@@ -829,7 +831,7 @@ ps_err_e
 ps_pdwrite (gdb_ps_prochandle_t ph, gdb_ps_addr_t addr,
            gdb_ps_write_buf_t buf, gdb_ps_size_t size)
 {
-  return rw_common (1, ph, addr, (char *) buf, size);
+  return rw_common (1, ph, addr, (gdb_byte *) buf, size);
 }
 
 /* Copies SIZE bytes from target process .text segment to debugger memory.  */
@@ -847,7 +849,7 @@ ps_err_e
 ps_ptwrite (gdb_ps_prochandle_t ph, gdb_ps_addr_t addr,
            gdb_ps_write_buf_t buf, gdb_ps_size_t size)
 {
-  return rw_common (1, ph, addr, (char *) buf, size);
+  return rw_common (1, ph, addr, (gdb_byte *) buf, size);
 }
 
 /* Get general-purpose registers for LWP.  */
@@ -1015,17 +1017,18 @@ solaris_pid_to_str (struct target_ops *ops, ptid_t ptid)
       lwp = thread_to_lwp (ptid, -2);
 
       if (PIDGET (lwp) == -1)
-       sprintf (buf, "Thread %ld (defunct)", GET_THREAD (ptid));
+       xsnprintf (buf, sizeof (buf), "Thread %ld (defunct)",
+                  GET_THREAD (ptid));
       else if (PIDGET (lwp) != -2)
-       sprintf (buf, "Thread %ld (LWP %ld)",
+       xsnprintf (buf, sizeof (buf), "Thread %ld (LWP %ld)",
                 GET_THREAD (ptid), GET_LWP (lwp));
       else
-       sprintf (buf, "Thread %ld        ", GET_THREAD (ptid));
+       xsnprintf (buf, sizeof (buf), "Thread %ld        ", GET_THREAD (ptid));
     }
   else if (GET_LWP (ptid) != 0)
-    sprintf (buf, "LWP    %ld        ", GET_LWP (ptid));
+    xsnprintf (buf, sizeof (buf), "LWP    %ld        ", GET_LWP (ptid));
   else
-    sprintf (buf, "process %d    ", PIDGET (ptid));
+    xsnprintf (buf, sizeof (buf), "process %d    ", PIDGET (ptid));
 
   return buf;
 }
@@ -1112,11 +1115,12 @@ info_cb (const td_thrhandle_t *th, void *s)
       /* Print thr_create start function.  */
       if (ti.ti_startfunc != 0)
        {
-         struct minimal_symbol *msym;
-         msym = lookup_minimal_symbol_by_pc (ti.ti_startfunc);
-         if (msym)
+         const struct bound_minimal_symbol msym
+           = lookup_minimal_symbol_by_pc (ti.ti_startfunc);
+
+         if (msym.minsym)
            printf_filtered ("   startfunc: %s\n",
-                            SYMBOL_PRINT_NAME (msym));
+                            SYMBOL_PRINT_NAME (msym.minsym));
          else
            printf_filtered ("   startfunc: %s\n",
                             paddress (target_gdbarch (), ti.ti_startfunc));
@@ -1125,11 +1129,12 @@ info_cb (const td_thrhandle_t *th, void *s)
       /* If thread is asleep, print function that went to sleep.  */
       if (ti.ti_state == TD_THR_SLEEP)
        {
-         struct minimal_symbol *msym;
-         msym = lookup_minimal_symbol_by_pc (ti.ti_pc);
-         if (msym)
+         const struct bound_minimal_symbol msym
+           = lookup_minimal_symbol_by_pc (ti.ti_pc);
+
+         if (msym.minsym)
            printf_filtered (" - Sleep func: %s\n",
-                            SYMBOL_PRINT_NAME (msym));
+                            SYMBOL_PRINT_NAME (msym.minsym));
          else
            printf_filtered (" - Sleep func: %s\n",
                             paddress (target_gdbarch (), ti.ti_startfunc));
This page took 0.025841 seconds and 4 git commands to generate.