Fix -Werror -Wuninitialized warnings.
[deliverable/binutils-gdb.git] / gdb / sol-thread.c
index be51710ffed912d7d07b74dd7e36cb441c565838..cc1e20cad9500ee61d21728dca0ccb6549de36c9 100644 (file)
@@ -1,5 +1,6 @@
 /* Low level interface for debugging Solaris threads for GDB, the GNU debugger.
-   Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -58,6 +59,7 @@
 #include <dlfcn.h>
 #include "gdbcmd.h"
 #include "gdbcore.h"
+#include "regcache.h"
 
 extern struct target_ops sol_thread_ops;       /* Forward declaration */
 extern struct target_ops sol_core_ops; /* Forward declaration */
@@ -424,13 +426,17 @@ lwp_to_thread (int lwp)
 static struct cleanup *
 save_inferior_pid (void)
 {
-  return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
+  int *saved_pid = xmalloc (sizeof (int));
+  *saved_pid = inferior_pid;
+  return make_cleanup (restore_inferior_pid, saved_pid);
 }
 
 static void
-restore_inferior_pid (void *pid)
+restore_inferior_pid (void *data)
 {
-  inferior_pid = (int) pid;
+  int *saved_pid = data;
+  inferior_pid = *saved_pid;
+  xfree (saved_pid);
 }
 \f
 
@@ -685,7 +691,7 @@ sol_thread_store_registers (int regno)
   if (regno != -1)
     {                          /* Not writing all the regs */
       /* save new register value */
-      char old_value[REGISTER_SIZE];
+      char* old_value = (char*) alloca (REGISTER_SIZE);
       memcpy (old_value, &registers[REGISTER_BYTE (regno)], REGISTER_SIZE);
 
       val = p_td_thr_getgregs (&thandle, gregset);
@@ -762,6 +768,7 @@ sol_thread_prepare_to_store (void)
 
 static int
 sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+                       struct mem_attrib *attrib,
                        struct target_ops *target)
 {
   int retval;
@@ -775,10 +782,11 @@ sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
   /* Note: don't need to call switch_to_thread; we're just reading memory.  */
 
   if (target_has_execution)
-    retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, target);
+    retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, 
+                                       dowrite, attrib, target);
   else
     retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
-                                          dowrite, target);
+                                          dowrite, attrib, target);
 
   do_cleanups (old_chain);
 
@@ -1060,10 +1068,13 @@ rw_common (int dowrite, const struct ps_prochandle *ph, gdb_ps_addr_t addr,
     {
       int cc;
 
+      /* FIXME: passing 0 as attrib argument.  */
       if (target_has_execution)
-       cc = procfs_ops.to_xfer_memory (addr, buf, size, dowrite, &procfs_ops);
+       cc = procfs_ops.to_xfer_memory (addr, buf, size, 
+                                       dowrite, 0, &procfs_ops);
       else
-       cc = orig_core_ops.to_xfer_memory (addr, buf, size, dowrite, &core_ops);
+       cc = orig_core_ops.to_xfer_memory (addr, buf, size, 
+                                          dowrite, 0, &core_ops);
 
       if (cc < 0)
        {
This page took 0.04672 seconds and 4 git commands to generate.