2004-01-09 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / sol-thread.c
index 35cb5786561d71f4a5dc798266442c173d09b827..72313dcb29c460b451af4928138a13b081f61442 100644 (file)
@@ -1,5 +1,5 @@
 /* Low level interface for debugging Solaris threads for GDB, the GNU debugger.
-   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GDB.
 #include "target.h"
 #include "inferior.h"
 #include <fcntl.h>
-#include <sys/stat.h>
+#include "gdb_stat.h"
 #include <dlfcn.h>
 #include "gdbcmd.h"
 #include "gdbcore.h"
 #include "regcache.h"
 #include "symfile.h"
 
+#include "gdb_string.h"
+
 extern struct target_ops sol_thread_ops;       /* Forward declaration */
 extern struct target_ops sol_core_ops; /* Forward declaration */
 
@@ -399,8 +401,6 @@ lwp_to_thread (ptid_t lwp)
 /* Most target vector functions from here on actually just pass through to
    procfs.c, as they don't need to do anything specific for threads.  */
 
-
-/* ARGSUSED */
 static void
 sol_thread_open (char *arg, int from_tty)
 {
@@ -646,9 +646,10 @@ sol_thread_store_registers (int regno)
 
   if (regno != -1)
     {                          /* Not writing all the regs */
-      /* save new register value */
-      char* old_value = (char*) alloca (REGISTER_SIZE);
-      memcpy (old_value, &registers[REGISTER_BYTE (regno)], REGISTER_SIZE);
+      char old_value[MAX_REGISTER_SIZE];
+      
+      /* Save new register value.  */
+      regcache_collect (regno, old_value);
 
       val = p_td_thr_getgregs (&thandle, gregset);
       if (val != TD_OK)
@@ -659,8 +660,8 @@ sol_thread_store_registers (int regno)
        error ("sol_thread_store_registers: td_thr_getfpregs %s",
               td_err_string (val));
 
-      /* restore new register value */
-      memcpy (&registers[REGISTER_BYTE (regno)], old_value, REGISTER_SIZE);
+      /* Restore new register value.  */
+      supply_register (regno, old_value);
 
 #if 0
 /* thread_db doesn't seem to handle this right */
@@ -1474,7 +1475,7 @@ info_cb (const td_thrhandle_t *th, void *s)
          struct minimal_symbol *msym;
          msym = lookup_minimal_symbol_by_pc (ti.ti_startfunc);
          if (msym)
-           printf_filtered ("   startfunc: %s\n", SYMBOL_NAME (msym));
+           printf_filtered ("   startfunc: %s\n", DEPRECATED_SYMBOL_NAME (msym));
          else
            printf_filtered ("   startfunc: 0x%s\n", paddr (ti.ti_startfunc));
        }
@@ -1485,7 +1486,7 @@ info_cb (const td_thrhandle_t *th, void *s)
          struct minimal_symbol *msym;
          msym = lookup_minimal_symbol_by_pc (ti.ti_pc);
          if (msym)
-           printf_filtered (" - Sleep func: %s\n", SYMBOL_NAME (msym));
+           printf_filtered (" - Sleep func: %s\n", DEPRECATED_SYMBOL_NAME (msym));
          else
            printf_filtered (" - Sleep func: 0x%s\n", paddr (ti.ti_startfunc));
        }
@@ -1540,7 +1541,6 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_longname = "Solaris threads and pthread.";
   sol_thread_ops.to_doc = "Solaris threads and pthread support.";
   sol_thread_ops.to_open = sol_thread_open;
-  sol_thread_ops.to_close = 0;
   sol_thread_ops.to_attach = sol_thread_attach;
   sol_thread_ops.to_detach = sol_thread_detach;
   sol_thread_ops.to_resume = sol_thread_resume;
@@ -1559,8 +1559,6 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_terminal_save_ours = terminal_save_ours;
   sol_thread_ops.to_terminal_info = child_terminal_info;
   sol_thread_ops.to_kill = sol_thread_kill_inferior;
-  sol_thread_ops.to_load = 0;
-  sol_thread_ops.to_lookup_symbol = 0;
   sol_thread_ops.to_create_inferior = sol_thread_create_inferior;
   sol_thread_ops.to_mourn_inferior = sol_thread_mourn_inferior;
   sol_thread_ops.to_can_run = sol_thread_can_run;
@@ -1576,8 +1574,6 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_has_registers = 1;
   sol_thread_ops.to_has_execution = 1;
   sol_thread_ops.to_has_thread_control = tc_none;
-  sol_thread_ops.to_sections = 0;
-  sol_thread_ops.to_sections_end = 0;
   sol_thread_ops.to_find_memory_regions = sol_find_memory_regions;
   sol_thread_ops.to_make_corefile_notes = sol_make_note_section;
   sol_thread_ops.to_magic = OPS_MAGIC;
@@ -1594,30 +1590,16 @@ init_sol_core_ops (void)
   sol_core_ops.to_close = sol_core_close;
   sol_core_ops.to_attach = sol_thread_attach;
   sol_core_ops.to_detach = sol_core_detach;
-  /* sol_core_ops.to_resume  = 0; */
-  /* sol_core_ops.to_wait  = 0;  */
   sol_core_ops.to_fetch_registers = sol_thread_fetch_registers;
-  /* sol_core_ops.to_store_registers  = 0; */
-  /* sol_core_ops.to_prepare_to_store  = 0; */
   sol_core_ops.to_xfer_memory = sol_thread_xfer_memory;
   sol_core_ops.to_files_info = sol_core_files_info;
   sol_core_ops.to_insert_breakpoint = ignore;
   sol_core_ops.to_remove_breakpoint = ignore;
-  /* sol_core_ops.to_terminal_init  = 0; */
-  /* sol_core_ops.to_terminal_inferior  = 0; */
-  /* sol_core_ops.to_terminal_ours_for_output  = 0; */
-  /* sol_core_ops.to_terminal_ours  = 0; */
-  /* sol_core_ops.to_terminal_info  = 0; */
-  /* sol_core_ops.to_kill  = 0; */
-  /* sol_core_ops.to_load  = 0; */
-  /* sol_core_ops.to_lookup_symbol  = 0; */
   sol_core_ops.to_create_inferior = sol_thread_create_inferior;
   sol_core_ops.to_stratum = core_stratum;
-  sol_core_ops.to_has_all_memory = 0;
   sol_core_ops.to_has_memory = 1;
   sol_core_ops.to_has_stack = 1;
   sol_core_ops.to_has_registers = 1;
-  sol_core_ops.to_has_execution = 0;
   sol_core_ops.to_has_thread_control = tc_none;
   sol_core_ops.to_thread_alive = sol_thread_alive;
   sol_core_ops.to_pid_to_str = solaris_pid_to_str;
@@ -1626,8 +1608,6 @@ init_sol_core_ops (void)
      <n> in procinfo list" where <n> is the pid of the process that produced
      the core file.  Disable it for now. */
   /* sol_core_ops.to_find_new_threads = sol_find_new_threads; */
-  sol_core_ops.to_sections = 0;
-  sol_core_ops.to_sections_end = 0;
   sol_core_ops.to_magic = OPS_MAGIC;
 }
 
This page took 0.028637 seconds and 4 git commands to generate.