* gdb.base/help.exp: Allow Win32 child process.
[deliverable/binutils-gdb.git] / gdb / sol-thread.c
index f92c49e4b3f8f53b0d2018b4127b412d5bf2765b..1d379e9ec19020f7cb1c79683b3fab34bf0d2245 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
+   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"
 
 extern struct target_ops sol_thread_ops;       /* Forward declaration */
 extern struct target_ops sol_core_ops; /* Forward declaration */
@@ -415,7 +416,7 @@ sol_thread_attach (char *args, int from_tty)
   procfs_ops.to_attach (args, from_tty);
 
   /* Must get symbols from solibs before libthread_db can run! */
-  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0);
+  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0, auto_solib_add);
 
   if (sol_thread_active)
     {
@@ -647,7 +648,8 @@ sol_thread_store_registers (int regno)
     {                          /* 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);
+      memcpy (old_value, &deprecated_registers[REGISTER_BYTE (regno)],
+             REGISTER_SIZE);
 
       val = p_td_thr_getgregs (&thandle, gregset);
       if (val != TD_OK)
@@ -659,7 +661,8 @@ sol_thread_store_registers (int regno)
               td_err_string (val));
 
       /* restore new register value */
-      memcpy (&registers[REGISTER_BYTE (regno)], old_value, REGISTER_SIZE);
+      memcpy (&deprecated_registers[REGISTER_BYTE (regno)], old_value,
+             REGISTER_SIZE);
 
 #if 0
 /* thread_db doesn't seem to handle this right */
@@ -1473,7 +1476,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));
        }
@@ -1484,7 +1487,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));
        }
@@ -1509,6 +1512,22 @@ info_solthreads (char *args, int from_tty)
                    TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
 }
 
+static int
+sol_find_memory_regions (int (*func) (CORE_ADDR, 
+                                     unsigned long, 
+                                     int, int, int, 
+                                     void *), 
+                        void *data)
+{
+  return procfs_ops.to_find_memory_regions (func, data);
+}
+
+static char *
+sol_make_note_section (bfd *obfd, int *note_size)
+{
+  return procfs_ops.to_make_corefile_notes (obfd, note_size);
+}
+
 static int
 ignore (CORE_ADDR addr, char *contents)
 {
@@ -1523,7 +1542,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;
@@ -1539,10 +1557,9 @@ init_sol_thread_ops (void)
   sol_thread_ops.to_terminal_inferior = terminal_inferior;
   sol_thread_ops.to_terminal_ours_for_output = terminal_ours_for_output;
   sol_thread_ops.to_terminal_ours = terminal_ours;
+  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;
@@ -1558,8 +1575,8 @@ 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;
 }
 
@@ -1574,30 +1591,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;
@@ -1606,8 +1609,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.026486 seconds and 4 git commands to generate.